Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
physics.c
Go to the documentation of this file.
1
5
15typedef int[] Physics;
17{
18 static const float KMH2MS = 1 / 3.6; //<! Constant for converting km/h to m/s
19 static const float MS2KMH = 3.6; //<! Constant for converting m/s to km/h
20 static const float STANDARD_GRAVITY = 9.81;
21 static const vector VGravity = "0 -9.81 0";
22
24 proto external void Destroy();
29 proto external void SetInteractionLayer(int mask);
31 proto external void GetWorldTransform(out vector mat[4]);
33 proto external void GetDirectWorldTransform(out vector mat[4]);
35 proto external void SetGeomInteractionLayer(int index, int mask);
37 proto external int GetInteractionLayer();
39 proto external bool HasInteractionEnabled(int mask);
41 proto external int GetGeomInteractionLayer(int index);
49 proto external void EnableCCD(float maxMotion, float sphereCastRadius);
51 proto external void ChangeSimulationState(SimulationState simState);
55 proto external vector GetCenterOfMass();
57 proto external void SetActive(ActiveState act);
59 proto external bool IsActive();
61 proto external bool IsDynamic();
63 proto external bool IsKinematic();
65 proto external bool EnableGravity(bool enable);
67 proto external void SetDamping(float linearDamping, float angularDamping);
69 proto external float GetMass();
71 proto external void SetMass(float mass);
76 proto external void SetInertiaTensorV(vector v);
78 proto external vector GetAngularVelocity();
80 proto external vector GetVelocityAt(vector pos);
82 proto external void SetSleepingTreshold(float linearTreshold, float angularTreshold);
84 proto external void SetLinearFactor(vector linearFactor);
86 proto external vector GetVelocity();
88 proto external void SetVelocity(vector velocity);
90 proto external void SetAngularVelocity(vector velocity);
94 proto external void SetTargetMatrix(vector matrix[4], float timeslice);
96 proto external void ApplyImpulse(vector impulse);
98 proto external void ApplyImpulseAt(vector pos, vector impulse);
100 proto external void ApplyForce(vector force);
102 proto external void ApplyForceAt(vector pos, vector force);
104 proto external void ApplyTorque(vector torque);
106 proto external void ClearForces();
108 proto external vector GetTotalForce();
110 proto external vector GetTotalTorque();
115 proto external void SetResponseIndex(int responseIndex);
117 proto external int GetResponseIndex();
134 proto external int AddGeom(string name, PhysicsGeom geom, vector frame[4], string material, int interactionLayer);
136 proto external int GetGeom(string name);
138 proto external int GetNumGeoms();
140 proto external bool UpdateGeometries(int interactionLayerAnd = 0xffffffff, int interactionLayerOr = 0);
142 proto external string GetGeomName(int index);
144 proto external void GetGeomWorldTransform(int index, out vector mat[4]);
146 proto external void GetGeomTransform(int index, out vector mat[4]);
148 proto external void GetGeomDirectTransform(int index, out vector mat[4]);
150 proto external vector GetGeomWorldPosition(int index);
152 proto external vector GetGeomPosition(int index);
154 proto external vector GetGeomDirectPosition(int index);
156 proto external void GetGeomWorldBounds(int index, out vector min, out vector max);
158 proto external void GetGeomDirectBounds(int index, out vector min, out vector max);
160 proto external void GetGeomSurfaces(int index, notnull out array<SurfaceProperties> surfaces);
162 proto external int GetNumBones();
164 proto external Physics GetBone(int index);
170 static proto Physics CreateStatic(notnull IEntity ent, int layerMask = 0xffffffff);
182 static proto Physics CreateStaticEx(notnull IEntity ent, PhysicsGeomDef geoms[]);
189 static proto Physics CreateDynamic(notnull IEntity ent, float mass, int layerMask = 0xffffffff);
204 static proto Physics CreateDynamicEx(notnull IEntity ent, vector centerOfMass, float mass, PhysicsGeomDef geoms[]);
210 static proto Physics CreateGhostEx(notnull IEntity ent, PhysicsGeomDef geoms[]);
211}
212
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Internal ancestor of all Entity implementations.
Definition enentity.c:165
Geometry element properties.
static const float STANDARD_GRAVITY
Definition physics.c:20
proto external int GetNumBones()
Returns the number of bones.
proto external vector GetCenterOfMass()
Returns center of mass offset of the physics body.
proto external void ApplyForce(vector force)
Applies constant force on the physics body (at origin).
proto external void ApplyImpulse(vector impulse)
Applies impulse on the physics body.
proto external void ApplyImpulseAt(vector pos, vector impulse)
Applies impulse on the physics body at a position (world space coordinates).
proto external void GetDirectWorldTransform(out vector mat[4])
Returns internal world space transformation of the physics body (excluding scale).
static proto Physics CreateDynamicEx(notnull IEntity ent, vector centerOfMass, float mass, PhysicsGeomDef geoms[])
Creates a dynamic physics body from custom made geometries.
proto external vector GetGeomWorldPosition(int index)
Returns world space position of a geometry element.
proto external void GetGeomDirectTransform(int index, out vector mat[4])
Returns internal physics space transformation of a geometry element.
proto external void GetGeomDirectBounds(int index, out vector min, out vector max)
Returns internal physics bounds of a geometry element (at scale 1).
static proto Physics CreateStaticEx(notnull IEntity ent, PhysicsGeomDef geoms[])
Creates a static physics body from custom made geometries.
proto external bool UpdateGeometries(int interactionLayerAnd=0xffffffff, int interactionLayerOr=0)
Returns world space transformation of a geometry element.
static proto Physics CreateDynamic(notnull IEntity ent, float mass, int layerMask=0xffffffff)
Creates a dynamic physics body from geometry embedded in attached VObject.
proto external SimulationState GetSimulationState()
Returns simulation state of the physics body.
proto external void GetGeomWorldTransform(int index, out vector mat[4])
Returns world space transformation of a geometry element.
proto external void ApplyForceAt(vector pos, vector force)
Applies constant force on the physics body at a position (world space coordinates).
proto external void SetLinearFactor(vector linearFactor)
Sets scale factor for all impulses/velocities/forces. Default is <1,1,1>. Zero any axis if you want t...
static proto Physics CreateGhostEx(notnull IEntity ent, PhysicsGeomDef geoms[])
Creates a ghost physics body from custom made geometries.
proto external void SetSleepingTreshold(float linearTreshold, float angularTreshold)
Changes thresholds used to determine whether the physics body can stop simulation.
proto external int GetInteractionLayer()
Returns interaction layer mask of the physics body.
static const vector VGravity
Definition physics.c:21
proto external vector GetTotalForce()
Returns total force currently applied to the physics body.
proto external int GetResponseIndex()
Returns actual index to response matrix.
proto external bool IsDynamic()
Returns whether the physics body is dynamic (a rigid body).
proto external void SetInertiaTensorV(vector v)
Changes inertia tensor of the physics body.
proto external void ChangeSimulationState(SimulationState simState)
Changes simulation state of the physics body.
proto external void SetAngularVelocity(vector velocity)
Sets angular velocity of the physics body.
proto external Physics GetBone(int index)
Returns the bone at the index.
proto external void SetInteractionLayer(int mask)
Sets interaction layer mask of the physics body.
proto external void GetGeomSurfaces(int index, notnull out array< SurfaceProperties > surfaces)
Returns all surface properties of a geometry element.
proto external void SetResponseIndex(int responseIndex)
Changes index to response matrix, see "project settings/physics/interactions/response matrix".
static const float KMH2MS
Definition physics.c:18
proto external void GetWorldTransform(out vector mat[4])
Returns world space transformation of the physics body (including scale).
proto external bool EnableGravity(bool enable)
Enables gravity on the physics body.
proto external void SetDamping(float linearDamping, float angularDamping)
Changes damping parameters of the physics body.
proto external bool IsKinematic()
Returns whether the physics body is kinematic (animated).
proto external void SetGeomInteractionLayer(int index, int mask)
Sets interaction layer mask of the geometry element.
proto external void SetVelocity(vector velocity)
Sets linear velocity of the physics body.
proto external vector GetGeomDirectPosition(int index)
Returns internal physics space position of a geometry element.
proto external int GetGeom(string name)
Finds a geometry by its name and returns its index or -1 if the geometry wasn't found.
proto external int AddGeom(string name, PhysicsGeom geom, vector frame[4], string material, int interactionLayer)
Adds new geometry and returns an index of the geometry or -1 when an error occurred.
proto external vector GetTotalTorque()
Returns total torque currently applied to the physics body.
proto external void ApplyTorque(vector torque)
Applies constant torque on the physics body.
proto external vector GetVelocityAt(vector pos)
Returns linear velocity of the physics body at a position (world space coordinates).
proto external void SetTargetMatrix(vector matrix[4], float timeslice)
Sets target transformation.
proto external vector GetVelocity()
Returns linear velocity of the physics body.
proto external vector GetAngularVelocity()
Returns angular velocity of the physics body.
static const float MS2KMH
Definition physics.c:19
proto external int GetGeomInteractionLayer(int index)
Returns interaction layer mask of the geometry element.
proto external void EnableCCD(float maxMotion, float sphereCastRadius)
Changes state of the continuous collision detection (CCD).
proto external void Destroy()
Destroys the physics body.
proto external void SetMass(float mass)
Changes mass of the physics body.
proto external int GetNumGeoms()
Returns number of geometries of the entity.
proto external void ClearForces()
Clear forces and torques on the physics body.
proto external void GetGeomWorldBounds(int index, out vector min, out vector max)
Returns world bounds of a geometry element.
proto external bool IsActive()
Returns whether the physics body is being simulated (awake).
proto external float GetMass()
Returns mass of the physics body.
proto external void GetGeomTransform(int index, out vector mat[4])
Returns entity space transformation of a geometry element.
proto external string GetGeomName(int index)
Returns name of a geometry element.
static proto Physics CreateStatic(notnull IEntity ent, int layerMask=0xffffffff)
Creates a static physics body from geometry embedded in attached VObject.
proto external bool HasInteractionEnabled(int mask)
Returns true if the physics body has enabled interaction with other body's layer mask.
proto external vector GetGeomPosition(int index)
Returns entity space position of a geometry element.
proto external void SetActive(ActiveState act)
Changes activation state of the physics body.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
SimulationState
State/presence of the physics controller in physics world.
ActiveState
Activation state of the physics controller in the physics world.
Definition activestate.c:10