Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MoveInCircleComponent.c
Go to the documentation of this file.
1 class SCR_MoveInCircleComponentClass : ScriptComponentClass
2 {
3 }
4 
6 {
7  protected ref TVectorArray m_CirclePoints = {};
8  protected float m_fElapsedTime = 0;
9 
10  //------------------------------------------------------------------------------------------------
11  override protected void EOnFixedFrame(IEntity owner, float timeSlice)
12  {
13  super.EOnFixedFrame(owner, timeSlice);
14 
15  m_fElapsedTime += timeSlice / 10;
16  if(m_fElapsedTime >= 1)
17  m_fElapsedTime -= 1;
18 
19  vector mat[4];
20  Math3D.MatrixIdentity4(mat);
21 
22  mat[3] = Math3D.Curve(ECurveType.NaturalCubic, m_fElapsedTime, m_CirclePoints);
23  Math3D.AnglesToMatrix(Vector(Math.Lerp(0, 360, m_fElapsedTime), 0.0, 0.0), mat);
24  owner.SetTransform(mat);
25  }
26 
27  //------------------------------------------------------------------------------------------------
28  override void OnPostInit(IEntity owner)
29  {
30  super.OnPostInit(owner);
31 
32  SetEventMask(owner, EntityEvent.INIT | EntityEvent.FIXEDFRAME);
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  override void EOnInit(IEntity owner)
37  {
38  vector entityPos = owner.GetOrigin();
39  for (float i = 0; i < Math.PI2; )
40  {
41  float x = Math.Cos(i) * 10;
42  float y = Math.Sin(i) * 10;
43  i = i + 0.03;
44  m_CirclePoints.Insert(Vector(entityPos[0] + x, entityPos[1], entityPos[2] + y));
45  }
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  // constructor
53  void SCR_MoveInCircleComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
54  {
55  }
56 }
EOnFixedFrame
override protected void EOnFixedFrame(IEntity owner, float timeSlice)
Definition: SCR_MoveInCircleComponent.c:11
SCR_MoveInCircleComponentClass
Definition: SCR_MoveInCircleComponent.c:1
m_fElapsedTime
protected float m_fElapsedTime
Definition: SCR_MoveInCircleComponent.c:8
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_MoveInCircleComponent.c:28
SCR_MoveInCircleComponent
void SCR_MoveInCircleComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_MoveInCircleComponent.c:53
m_CirclePoints
SCR_MoveInCircleComponentClass m_CirclePoints
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_MoveInCircleComponent.c:36