Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
RigidBody API

Modules

 Geometry API definition
 

Data Structures

class  PhysicsGeomDef
 

Enumerations

enum  ActiveState { ACTIVE, INACTIVE, ALWAYS_ACTIVE }
 state of a rigidbody More...
 

Functions

proto bool dBodyCreateStaticEx (notnull IEntity ent, PhysicsGeomDef geoms[])
 
proto bool dBodyCreateGhostEx (notnull IEntity ent, PhysicsGeomDef geoms[])
 
proto bool dBodyCreateDynamicEx (notnull IEntity ent, vector centerOfMass, float mass, PhysicsGeomDef geoms[])
 
proto native void dBodyDestroy (notnull IEntity ent)
 Destroys attached physics body. More...
 
proto native bool dBodyIsSet (notnull IEntity ent)
 Has the entity attached physics body? More...
 
proto native void dBodySetInteractionLayer (notnull IEntity ent, int mask)
 
proto native int dBodyGetInteractionLayer (notnull IEntity ent)
 
proto native void dBodySetGeomInteractionLayer (notnull IEntity ent, int index, int mask)
 
proto native int dBodyGetGeomInteractionLayer (notnull IEntity ent, int index)
 
proto native void dBodyActive (notnull IEntity ent, ActiveState activeState)
 
proto native void dBodyDynamic (notnull IEntity ent, bool dynamic)
 
proto native bool dBodyIsDynamic (notnull IEntity ent)
 
proto native bool dBodyIsActive (notnull IEntity ent)
 
proto native bool dBodyEnableGravity (notnull IEntity ent, bool enable)
 
proto native void dBodySetDamping (notnull IEntity ent, float linearDamping, float angularDamping)
 
proto native void dBodySetSleepingTreshold (notnull IEntity body, float linearTreshold, float angularTreshold)
 
proto native bool dBodyIsSolid (notnull IEntity ent)
 
proto native void dBodySetSolid (notnull IEntity ent, bool solid)
 
proto native void dBodyEnableCCD (notnull IEntity body, float maxMotion, float sphereCastRadius)
 
proto native void dBodySetLinearFactor (notnull IEntity body, vector linearFactor)
 
proto native vector dBodyGetCenterOfMass (notnull IEntity body)
 returns center of mass offset More...
 
proto native vector GetVelocity (notnull IEntity ent)
 Returns linear velocity. More...
 
proto native void SetVelocity (notnull IEntity ent, vector vel)
 Sets linear velocity (for Rigid bodies) More...
 
proto native dBlock dBodyCollisionBlock (notnull IEntity ent1, notnull IEntity ent2)
 Disables collisions between two entities. More...
 
proto native void dBodyRemoveBlock (notnull IEntity worldEntity, dBlock block)
 
proto native void dBodySetInertiaTensorV (notnull IEntity body, vector v)
 
proto native void dBodySetInertiaTensorM (notnull IEntity body, vector m[3])
 
proto native float dBodyGetMass (notnull IEntity ent)
 
proto native void dBodySetMass (notnull IEntity body, float mass)
 
proto native void dBodyApplyTorqueImpulse (notnull IEntity ent, vector torqueImpulse)
 
proto native vector dBodyGetInvInertiaDiagLocal (notnull IEntity ent)
 
proto native float dBodyComputeImpulseDenominator (notnull IEntity ent, vector position, vector normal)
 
proto native float dBodyComputeAngularImpulseDenominator (notnull IEntity ent, vector axis)
 
proto native vector dBodyGetLocalInertia (notnull IEntity ent)
 
proto void dBodyGetInvInertiaTensorWorld (notnull IEntity body, out vector inertiaTensorWS[3])
 
proto void dBodyApplyImpulseAt (notnull IEntity body, vector impulse, vector pos)
 Applies impuls on a pos position in world coordinates. More...
 
proto void dBodyApplyImpulse (notnull IEntity body, vector impulse)
 Applies impuls on a rigidbody (origin) More...
 
proto void dBodyApplyForce (notnull IEntity body, vector force)
 Applies constant force on a rigidbody (origin) More...
 
proto void dBodyApplyForceAt (notnull IEntity body, vector pos, vector force)
 Applies constant force on a position. More...
 
proto native void dBodyApplyTorque (notnull IEntity body, vector torque)
 
proto vector dBodyGetAngularVelocity (notnull IEntity body)
 Gets angular velocity for a rigidbody. More...
 
proto void dBodySetAngularVelocity (notnull IEntity body, vector angvel)
 Changed an angular velocity. More...
 
proto native void dBodySetTargetMatrix (notnull IEntity body, vector matrix[4], float timeslice)
 Sets target transformation. If timeslice == dt (simulation step delta time), it will happen in next step, otherwise in time = timeslice. More...
 
proto native float dBodyGetKineticEnergy (notnull IEntity body)
 
proto native vector dBodyGetVelocityAt (notnull IEntity body, vector globalpos)
 

Detailed Description

Enumeration Type Documentation

◆ ActiveState

state of a rigidbody

Enumerator
ACTIVE 
INACTIVE 
ALWAYS_ACTIVE 

Definition at line 85 of file enphysics.c.

Function Documentation

◆ dBodyActive()

proto native void dBodyActive ( notnull IEntity  ent,
ActiveState  activeState 
)

◆ dBodyApplyForce()

proto void dBodyApplyForce ( notnull IEntity  body,
vector  force 
)

Applies constant force on a rigidbody (origin)

◆ dBodyApplyForceAt()

proto void dBodyApplyForceAt ( notnull IEntity  body,
vector  pos,
vector  force 
)

Applies constant force on a position.

◆ dBodyApplyImpulse()

proto void dBodyApplyImpulse ( notnull IEntity  body,
vector  impulse 
)

Applies impuls on a rigidbody (origin)

◆ dBodyApplyImpulseAt()

proto void dBodyApplyImpulseAt ( notnull IEntity  body,
vector  impulse,
vector  pos 
)

Applies impuls on a pos position in world coordinates.

◆ dBodyApplyTorque()

proto native void dBodyApplyTorque ( notnull IEntity  body,
vector  torque 
)

◆ dBodyApplyTorqueImpulse()

proto native void dBodyApplyTorqueImpulse ( notnull IEntity  ent,
vector  torqueImpulse 
)

◆ dBodyCollisionBlock()

proto native dBlock dBodyCollisionBlock ( notnull IEntity  ent1,
notnull IEntity  ent2 
)

Disables collisions between two entities.

◆ dBodyComputeAngularImpulseDenominator()

proto native float dBodyComputeAngularImpulseDenominator ( notnull IEntity  ent,
vector  axis 
)

◆ dBodyComputeImpulseDenominator()

proto native float dBodyComputeImpulseDenominator ( notnull IEntity  ent,
vector  position,
vector  normal 
)

◆ dBodyCreateDynamicEx()

proto bool dBodyCreateDynamicEx ( notnull IEntity  ent,
vector  centerOfMass,
float  mass,
PhysicsGeomDef  geoms[] 
)

Creates RigidBody from custom made geometries. The geometries are deleted when rigid body is destroyed

Parameters
centerOfMassOffset from object-pivot to center of mass
massBody mass
geomsarray of custom made geometries
autoptr PhysicsGeomDef geoms[] = {PhysicsGeomDef("", dGeomCreateBox(size), "material/default", 0xffffffff)};
dBodyCreateDynamicEx(this, center, 1.0, geoms);

◆ dBodyCreateGhostEx()

proto bool dBodyCreateGhostEx ( notnull IEntity  ent,
PhysicsGeomDef  geoms[] 
)

◆ dBodyCreateStaticEx()

proto bool dBodyCreateStaticEx ( notnull IEntity  ent,
PhysicsGeomDef  geoms[] 
)

Creates RigidBody from custom made geometries. The geometries are deleted when rigid body is destroyed

Parameters
geomsarray of custom made geometries
autoptr PhysicsGeomDef geoms[] = {PhysicsGeomDef("", dGeomCreateBox(size), "material/default", 0xffffffff)};
dBodyCreateStaticEx(this, geoms);

◆ dBodyDestroy()

proto native void dBodyDestroy ( notnull IEntity  ent)

Destroys attached physics body.

◆ dBodyDynamic()

proto native void dBodyDynamic ( notnull IEntity  ent,
bool  dynamic 
)

◆ dBodyEnableCCD()

proto native void dBodyEnableCCD ( notnull IEntity  body,
float  maxMotion,
float  sphereCastRadius 
)

If both maxMotion and shapeCastRadius is >=0 then the continuous collision detection is enabled. If you want to disable it, use -1

Parameters
maxMotionmax motion threshold when sphere-cast is performed, to find time of impact. It should be little bit less than size of the geometry to catch the situation when tunelling can happen
sphereCastRadiusThe radius of the largest possible sphere, that is completelly inside the body geometry.

◆ dBodyEnableGravity()

proto native bool dBodyEnableGravity ( notnull IEntity  ent,
bool  enable 
)

◆ dBodyGetAngularVelocity()

proto vector dBodyGetAngularVelocity ( notnull IEntity  body)

Gets angular velocity for a rigidbody.

◆ dBodyGetCenterOfMass()

proto native vector dBodyGetCenterOfMass ( notnull IEntity  body)

returns center of mass offset

◆ dBodyGetGeomInteractionLayer()

proto native int dBodyGetGeomInteractionLayer ( notnull IEntity  ent,
int  index 
)

◆ dBodyGetInteractionLayer()

proto native int dBodyGetInteractionLayer ( notnull IEntity  ent)

◆ dBodyGetInvInertiaDiagLocal()

proto native vector dBodyGetInvInertiaDiagLocal ( notnull IEntity  ent)

◆ dBodyGetInvInertiaTensorWorld()

proto void dBodyGetInvInertiaTensorWorld ( notnull IEntity  body,
out vector  inertiaTensorWS[3] 
)

◆ dBodyGetKineticEnergy()

proto native float dBodyGetKineticEnergy ( notnull IEntity  body)

◆ dBodyGetLocalInertia()

proto native vector dBodyGetLocalInertia ( notnull IEntity  ent)

◆ dBodyGetMass()

proto native float dBodyGetMass ( notnull IEntity  ent)

◆ dBodyGetVelocityAt()

proto native vector dBodyGetVelocityAt ( notnull IEntity  body,
vector  globalpos 
)

◆ dBodyIsActive()

proto native bool dBodyIsActive ( notnull IEntity  ent)

◆ dBodyIsDynamic()

proto native bool dBodyIsDynamic ( notnull IEntity  ent)

◆ dBodyIsSet()

proto native bool dBodyIsSet ( notnull IEntity  ent)

Has the entity attached physics body?

◆ dBodyIsSolid()

proto native bool dBodyIsSolid ( notnull IEntity  ent)

◆ dBodyRemoveBlock()

proto native void dBodyRemoveBlock ( notnull IEntity  worldEntity,
dBlock  block 
)

◆ dBodySetAngularVelocity()

proto void dBodySetAngularVelocity ( notnull IEntity  body,
vector  angvel 
)

Changed an angular velocity.

Parameters
bodyRigid body
angvelAngular velocity, rotation around x, y and z axis (not yaw/pitch/roll)

◆ dBodySetDamping()

proto native void dBodySetDamping ( notnull IEntity  ent,
float  linearDamping,
float  angularDamping 
)

◆ dBodySetGeomInteractionLayer()

proto native void dBodySetGeomInteractionLayer ( notnull IEntity  ent,
int  index,
int  mask 
)

◆ dBodySetInertiaTensorM()

proto native void dBodySetInertiaTensorM ( notnull IEntity  body,
vector  m[3] 
)

◆ dBodySetInertiaTensorV()

proto native void dBodySetInertiaTensorV ( notnull IEntity  body,
vector  v 
)

◆ dBodySetInteractionLayer()

proto native void dBodySetInteractionLayer ( notnull IEntity  ent,
int  mask 
)

◆ dBodySetLinearFactor()

proto native void dBodySetLinearFactor ( notnull IEntity  body,
vector  linearFactor 
)

Sets scale factor for all impulses/velocities/forces. Default is <1,1,1>. Zero any axis if you want to do 2D physics

◆ dBodySetMass()

proto native void dBodySetMass ( notnull IEntity  body,
float  mass 
)

◆ dBodySetSleepingTreshold()

proto native void dBodySetSleepingTreshold ( notnull IEntity  body,
float  linearTreshold,
float  angularTreshold 
)

◆ dBodySetSolid()

proto native void dBodySetSolid ( notnull IEntity  ent,
bool  solid 
)

◆ dBodySetTargetMatrix()

proto native void dBodySetTargetMatrix ( notnull IEntity  body,
vector  matrix[4],
float  timeslice 
)

Sets target transformation. If timeslice == dt (simulation step delta time), it will happen in next step, otherwise in time = timeslice.

◆ GetVelocity()

proto native vector GetVelocity ( notnull IEntity  ent)

Returns linear velocity.

Parameters
entIEntity entity which origin will be set
matvector[4] matrix to be set
Returns
vector linear velocity
Man player = g_Game.GetPlayer();
Print( GetVelocity(player) );
>> <0,0,0>

◆ SetVelocity()

proto native void SetVelocity ( notnull IEntity  ent,
vector  vel 
)

Sets linear velocity (for Rigid bodies)

Parameters
ententity which velocity will be set
velvelocity vector to be set
PhysicsGeomDef
Definition: enphysics.c:31
Print
proto void Print(void var)
Prints content of variable to console/log.
dBodyCreateDynamicEx
proto bool dBodyCreateDynamicEx(notnull IEntity ent, vector centerOfMass, float mass, PhysicsGeomDef geoms[])
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
dGeomCreateBox
proto native dGeom dGeomCreateBox(vector size)
Creates box geometry.
dBodyCreateStaticEx
proto bool dBodyCreateStaticEx(notnull IEntity ent, PhysicsGeomDef geoms[])
GetVelocity
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.