Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
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)
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);
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 
GetGame
proto native CGame GetGame()
CameraShake
Definition: camerashake.c:1
m_Radius
float m_Radius
Definition: aigroupbehaviour.c:10
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
DayZPlayerImplement
Definition: manbase.c:1
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
Math
Definition: enmath.c:6