Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
camerashake.c
Go to the documentation of this file.
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)
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);
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 {
50 m_RandomAngle = -m_Radius + (Math.RandomFloat( -m_Radius / m_Smoothness, m_Radius / m_Smoothness));
51 }
52 else
53 {
54 m_RandomAngle = m_Radius + (Math.RandomFloat( -m_Radius / m_Smoothness, m_Radius / m_Smoothness));
55 }
56
57 x_axis = m_RandomAngle * m_StregthFactor;
58 y_axis = m_RandomAngle * m_StregthFactor;
59
60 //Print(x_axis);
61 //Print(y_axis);
62
63 if( m_Radius < 0.01 )
64 {
65 m_ToDelete = true;
66 }
67 }
68}
69
float m_Radius
DayZPlayerImplementAiming GetAimingModel()
void SetCamShakeValues(float x_axis, float y_axis)
Definition enmath.c:7
proto native CGame GetGame()
DayZPlayer m_Player
Definition hand_events.c:42
PlayerBase GetPlayer()