Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_JointDummyHolderEntity.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
2 class SCR_JointDummyHolderEntityClass: GenericEntityClass
3 {
4 };
5 
6 //------------------------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------------------------
12 {
13  vector m_FixedMat[4];
14  Physics m_Physics = null;
15 
16  //------------------------------------------------------------------------------------------------
17  void SetDummyTransform(vector mat[4])
18  {
19  m_FixedMat[0] = mat[0];
20  m_FixedMat[1] = mat[1];
21  m_FixedMat[2] = mat[2];
22  m_FixedMat[3] = mat[3];
23  SetTransform(mat);
24  }
25 
26  //------------------------------------------------------------------------------------------------
27  override event void EOnSimulate(IEntity owner, float timeSlice)
28  {
29  if (!m_Physics)
30  return;
31 
32  SetTransform(m_FixedMat);
33  m_Physics.SetAngularVelocity(vector.Zero);
34  m_Physics.SetVelocity(vector.Zero);
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  override event void EOnInit(IEntity owner)
39  {
40  GetTransform(m_FixedMat);
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  void SCR_JointDummyHolderEntity(IEntitySource src, IEntity parent)
45  {
46  SetEventMask(EntityEvent.INIT|EntityEvent.SIMULATE);
47 
48  ref PhysicsGeomDef geoms[1];
49  autoptr PhysicsGeomDef geom = new PhysicsGeomDef("", PhysicsGeom.CreateSphere(0.1), "material/default", EPhysicsLayerDefs.VehicleCast);
50  geoms[0] = geom;
51 
52  // Note: If using static geometry, the joint gets reoriented!
53  //m_Physics = Physics.CreateStaticEx(this, geoms);
54  m_Physics = Physics.CreateDynamicEx(this, vector.Zero, 999999, geoms);
55  m_Physics.SetLinearFactor(vector.Zero);
56  m_Physics.SetDamping(1000, 1000);
57  m_Physics.SetAngularVelocity(vector.Zero);
58  m_Physics.SetVelocity(vector.Zero);
59  }
60 
61  //------------------------------------------------------------------------------------------------
63  {
64  }
65 };
66 
m_Physics
private Physics m_Physics
Definition: InteractableBoxComponent.c:13
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_JointDummyHolderEntity
Definition: SCR_JointDummyHolderEntity.c:11
SetTransform
override void SetTransform(vector transform[4], bool changedByUser=false)
Definition: SCR_EditableCharacterComponent.c:455
SCR_JointDummyHolderEntityClass
Definition: SCR_JointDummyHolderEntity.c:2