Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
TestPushUserAction.c
Go to the documentation of this file.
1 // Script File
3 {
4 
5  [Attribute("5", UIWidgets.Slider, "Force multiplier (force is equal to mass * multiplier)", "0 100 0.1")]
6  float m_fForceMultiplier;
7  private Physics m_Physics;
8 
9  //------------------------------------------------------------------------------------------------
10  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
11  {
12  if (!GetGame().GetWorldEntity())
13  return;
14 
15  m_Physics = pOwnerEntity.GetPhysics();
16  }
17 
18  //------------------------------------------------------------------------------------------------
19  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
20  {
21  if (m_Physics)
22  {
23  GenericEntity genEnt = GenericEntity.Cast(pOwnerEntity);
25  if (boxComponent)
26  {
27  boxComponent.CancelDragAction();
28  }
29 
30 
31  vector userOrigin = pUserEntity.GetOrigin();
32  vector thisOrigin = pOwnerEntity.GetOrigin();
33  vector dir = thisOrigin-userOrigin;
34  dir.Normalize();
35  m_Physics.ApplyImpulse(dir * m_Physics.GetMass() * m_fForceMultiplier);
36  }
37  }
38 
39 };
TestPushUserAction
Definition: TestPushUserAction.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ScriptedUserAction
Definition: ScriptedUserAction.c:12
m_Physics
private Physics m_Physics
Definition: InteractableBoxComponent.c:13
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_InteractableBoxComponent
void SCR_InteractableBoxComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: InteractableBoxComponent.c:253
Attribute
typedef Attribute
Post-process effect of scripted camera.