DayZ Scripts
PC Stable Documentation
 
Loading...
Searching...
No Matches
Physics system

Modules

 RigidBody API
 

Data Structures

class  Contact
 
class  Physics
 
class  Physics6DOFJoint
 
class  Physics6DOFSpringJoint
 
class  PhysicsBallSocketJoint
 
class  PhysicsBlock
 
class  PhysicsConeTwistJoint
 
class  PhysicsFixedJoint
 
class  PhysicsGeom
 
class  PhysicsGeomDef
 
class  PhysicsHingeJoint
 
class  PhysicsJoint
 
class  PhysicsSliderJoint
 
class  PhysicsWorld
 
class  SurfaceProperties
 

Typedefs

typedef int[] Physics
 
typedef int[] Physics6DOFJoint
 
typedef int[] Physics6DOFSpringJoint
 
typedef int[] PhysicsBallSocketJoint
 
typedef int[] PhysicsBlock
 
typedef int[] PhysicsConeTwistJoint
 
typedef int[] PhysicsFixedJoint
 
typedef PhysicsGeom dGeom
 
typedef int[] PhysicsGeom
 
typedef int[] PhysicsHingeJoint
 
typedef int[] PhysicsJoint
 
typedef int[] PhysicsSliderJoint
 
typedef int[] SurfaceProperties
 
typedef int[] dJoint
 
typedef int[] dBlock
 

Enumerations

enum  ActiveState {
  INACTIVE , ACTIVE , ALWAYS_ACTIVE , INACTIVE ,
  ACTIVE , ALWAYS_ACTIVE
}
 
enum  ActiveState {
  INACTIVE , ACTIVE , ALWAYS_ACTIVE , INACTIVE ,
  ACTIVE , ALWAYS_ACTIVE
}
 
enum  SimulationState {
  NONE = -1 , COLLISION , SIMULATION , NONE = -1 ,
  COLLISION , SIMULATION
}
 
enum  SimulationState {
  NONE = -1 , COLLISION , SIMULATION , NONE = -1 ,
  COLLISION , SIMULATION
}
 

Functions

proto native int dGetNumDynamicBodies (notnull IEntity worldEnt)
 
proto native IEntity dGetDynamicBody (notnull IEntity worldEnt, int index)
 
proto native void dSetInteractionLayer (notnull IEntity worldEntity, int mask1, int mask2, bool enable)
 
proto native bool dGetInteractionLayer (notnull IEntity worldEntity, int mask1, int mask2)
 
proto native vector dGetGravity (notnull IEntity worldEntity)
 Gets global gravity.
 
proto native void dSetGravity (notnull IEntity worldEntity, vector g)
 Changes global gravity.
 
proto native void dSetTimeSlice (notnull IEntity worldEntity, float timeSlice)
 Changes fixed time-slice. Default is 1/40, thus simulation runs on 40fps. With smaller values, there is more precise simulation.
 

Detailed Description

Typedef Documentation

◆ dBlock

typedef int [] dBlock

◆ dGeom

typedef PhysicsGeom dGeom

Geometric shapes relevant for physics simulation

◆ dJoint

typedef int [] dJoint

◆ Physics

typedef int [] Physics

Wrapper over a physics simulation of an entity. The entity is capable of the physics simulation only when such object exists (see IEntity.GetPhysics). Two main types of physics bodies are static and dynamic. Static bodies are represented by a collision object and dynamic bodies by a rigid body. This means certain methods make sense only when dealing with a dynamic physics body, e.g., Physics.GetVelocity, Physics.ApplyImpulse.

Physics bodies rely on physics geometries to support collisions or casting. In general a physics body can be made out of multiply physics geometries. Certain methods allow to work with a specific physics geometry (via geometry index).

◆ Physics6DOFJoint

typedef int [] Physics6DOFJoint

6 DOF joint simulation.

The first 3 DOF axes represent linear motion (translation) and the latter 3 DOF axes represent angular motion. Each axis can be configured to be either free, locked or limited. All axes are locked initially. Some combinations can lead to an undefined behavior.

Configuration of the axes:

  • upper < lower - free axis
  • upper == lower - locked axis
  • upper > lower - limited axis

Ranges of the angular limits:

  • x axis - (-PI, PI)
  • y axis - (-PI/2, PI/2)
  • z axis - (-PI, PI)

◆ Physics6DOFSpringJoint

6 DOF spring joint simulation.

◆ PhysicsBallSocketJoint

Ball socket joint simulation

◆ PhysicsBlock

typedef int [] PhysicsBlock

Disables collisions between two entities.

◆ PhysicsConeTwistJoint

Cone twist joint simulation

◆ PhysicsFixedJoint

typedef int [] PhysicsFixedJoint

Fixed joint simulation

◆ PhysicsGeom

typedef int [] PhysicsGeom

◆ PhysicsHingeJoint

typedef int [] PhysicsHingeJoint

Hinge joint simulation

◆ PhysicsJoint

typedef int [] PhysicsJoint

Wrapper over joint simulation

Joint parameters

  • softness
    • 0->1, recommend ~0.8->1
    • describes % of limits where movement is free
    • beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached
  • biasFactor
    • 0->1?, recommend 0.3 +/-0.3 or so
    • strength with which constraint resists zeroth order (angular, not angular velocity) limit violation
  • relaxationFactor
    • 0->1, recommend to stay near 1
    • the lower the value, the less the constraint will fight velocities which violate the angular limits

◆ PhysicsSliderJoint

typedef int [] PhysicsSliderJoint

Slider joint simulation

◆ SurfaceProperties

typedef int [] SurfaceProperties

General surface properties

Enumeration Type Documentation

◆ ActiveState [1/2]

Activation state of the physics controller in the physics world.

Enumerator
INACTIVE 

body is not simulated (sleeps)

ACTIVE 

body is simulated

ALWAYS_ACTIVE 

body is simulated and cannot sleep

INACTIVE 

body is not simulated (sleeps)

ACTIVE 

body is simulated

ALWAYS_ACTIVE 

body is simulated and cannot sleep

◆ ActiveState [2/2]

Enumerator
INACTIVE 

body is not simulated (sleeps)

ACTIVE 

body is simulated

ALWAYS_ACTIVE 

body is simulated and cannot sleep

INACTIVE 

body is not simulated (sleeps)

ACTIVE 

body is simulated

ALWAYS_ACTIVE 

body is simulated and cannot sleep

◆ SimulationState [1/2]

State/presence of the physics controller in physics world. When it's created as static, only SimulationState::NONE or SimulationState::COLLISION can be used. For dynamic ones, there is also SimulationState::SIMULATION for full dynamic simulation.

Enumerator
NONE 

body is not in simulation, nor in collision world

No automatic destroying.

Flags to pass to ParticleSource.StopParticle.

Plain Effect base.

No flags

COLLISION 

body is in collision world, but it's not simulated

SIMULATION 

dynamic bodies are colliding and are simulated

NONE 

body is not in simulation, nor in collision world

No automatic destroying.

Flags to pass to ParticleSource.StopParticle.

Plain Effect base.

No flags

COLLISION 

body is in collision world, but it's not simulated

SIMULATION 

dynamic bodies are colliding and are simulated

◆ SimulationState [2/2]

Enumerator
NONE 

body is not in simulation, nor in collision world

No automatic destroying.

Flags to pass to ParticleSource.StopParticle.

Plain Effect base.

No flags

COLLISION 

body is in collision world, but it's not simulated

SIMULATION 

dynamic bodies are colliding and are simulated

NONE 

body is not in simulation, nor in collision world

No automatic destroying.

Flags to pass to ParticleSource.StopParticle.

Plain Effect base.

No flags

COLLISION 

body is in collision world, but it's not simulated

SIMULATION 

dynamic bodies are colliding and are simulated

Function Documentation

◆ dGetDynamicBody()

proto native IEntity dGetDynamicBody ( notnull IEntity  worldEnt,
int  index 
)

◆ dGetGravity()

proto native vector dGetGravity ( notnull IEntity  worldEntity)

Gets global gravity.

◆ dGetInteractionLayer()

proto native bool dGetInteractionLayer ( notnull IEntity  worldEntity,
int  mask1,
int  mask2 
)

◆ dGetNumDynamicBodies()

proto native int dGetNumDynamicBodies ( notnull IEntity  worldEnt)

◆ dSetGravity()

proto native void dSetGravity ( notnull IEntity  worldEntity,
vector  g 
)

Changes global gravity.

◆ dSetInteractionLayer()

proto native void dSetInteractionLayer ( notnull IEntity  worldEntity,
int  mask1,
int  mask2,
bool  enable 
)

◆ dSetTimeSlice()

proto native void dSetTimeSlice ( notnull IEntity  worldEntity,
float  timeSlice 
)

Changes fixed time-slice. Default is 1/40, thus simulation runs on 40fps. With smaller values, there is more precise simulation.