DayZ
1.24
Loading...
Searching...
No Matches
CameraShake.c
Go to the documentation of this file.
1
class
CameraShake
2
{
3
const
float
MIN_PLAYER_DISTANCE
= 40;
4
5
float
m_Radius
;
6
float
m_RadiusDecaySpeed
;
7
float
m_RandomAngle
;
8
float
m_Time
;
9
float
m_InitLR
;
10
float
m_InitUD
;
11
bool
m_ToDelete
;
12
float
m_Smoothness
;
13
float
m_StregthFactor
;
14
DayZPlayerImplement
m_Player
;
15
16
void
~CameraShake
()
17
{
18
if
(
m_Player
)
19
m_Player
.GetAimingModel().SetCamShakeValues(0, 0);
20
21
}
22
23
void
CameraShake
(
float
strength_factor
,
float
radius,
float
smoothness
,
float
radius_decay_speed
)
24
{
25
/*
26
27
Print("-----------ON CREATE------------");
28
Print(camera_offset);
29
Print("-----------ON CREATE END------------");
30
*/
31
//m_Player = DayZPlayerImplement.Cast(player);
32
m_Player
=
DayZPlayerImplement
.Cast(
GetGame
().
GetPlayer
());
33
m_StregthFactor
=
strength_factor
;
34
//m_InitLR = lr_angle;
35
//m_InitUD = ud_angle;
36
m_Radius
= radius;
37
m_RadiusDecaySpeed
=
radius_decay_speed
;
38
m_Smoothness
=
smoothness
;
39
}
40
41
void
Update
(
float
delta_time
,
out
float
x_axis
,
out
float
y_axis
)
42
{
43
if
(
m_ToDelete
)
44
delete
this
;
45
46
m_Radius
-=
delta_time
*
m_RadiusDecaySpeed
;
//diminish radius each frame
47
48
if
(
m_RandomAngle
>= 0)
49
m_RandomAngle
= -
m_Radius
+ (
Math
.
RandomFloat
(-
m_Radius
/
m_Smoothness
,
m_Radius
/
m_Smoothness
));
50
else
51
m_RandomAngle
=
m_Radius
+ (
Math
.
RandomFloat
(-
m_Radius
/
m_Smoothness
,
m_Radius
/
m_Smoothness
));
52
53
x_axis
=
m_RandomAngle
*
m_StregthFactor
;
54
y_axis
=
m_RandomAngle
*
m_StregthFactor
;
55
56
//Print(x_axis);
57
//Print(y_axis);
58
59
if
(
m_Radius
< 0.01)
60
m_ToDelete
=
true
;
61
}
62
}
63
GetPlayer
PlayerBase GetPlayer()
Definition
ModifierBase.c:47
CameraShake
Definition
CameraShake.c:2
CameraShake::m_Time
float m_Time
Definition
CameraShake.c:8
CameraShake::m_RandomAngle
float m_RandomAngle
Definition
CameraShake.c:7
CameraShake::m_Player
DayZPlayerImplement m_Player
Definition
CameraShake.c:14
CameraShake::~CameraShake
void ~CameraShake()
Definition
CameraShake.c:16
CameraShake::m_Radius
float m_Radius
Definition
CameraShake.c:5
CameraShake::m_ToDelete
bool m_ToDelete
Definition
CameraShake.c:11
CameraShake::m_Smoothness
float m_Smoothness
Definition
CameraShake.c:12
CameraShake::MIN_PLAYER_DISTANCE
const float MIN_PLAYER_DISTANCE
Definition
CameraShake.c:3
CameraShake::m_StregthFactor
float m_StregthFactor
Definition
CameraShake.c:13
CameraShake::m_InitLR
float m_InitLR
Definition
CameraShake.c:9
CameraShake::CameraShake
void CameraShake(float strength_factor, float radius, float smoothness, float radius_decay_speed)
Definition
CameraShake.c:23
CameraShake::m_InitUD
float m_InitUD
Definition
CameraShake.c:10
CameraShake::Update
void Update(float delta_time, out float x_axis, out float y_axis)
Definition
CameraShake.c:41
CameraShake::m_RadiusDecaySpeed
float m_RadiusDecaySpeed
Definition
CameraShake.c:6
DayZPlayerImplement
Definition
ManBase.c:2
Math
Definition
EnMath.c:7
Param3
Definition
EntityAI.c:95
GetGame
proto native CGame GetGame()
Math::RandomFloat
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
scripts
4_World
Classes
CameraShake.c
Generated by
1.10.0