RigidBody API
Part of Physics system
Topics
Functions
proto native void dBodyActive(notnull IEntity ent, ActiveState activeState) | more… | |
proto void dBodyApplyForce(notnull IEntity body, vector force) | Applies constant force on a rigidbody (origin) | |
proto void dBodyApplyForceAt(notnull IEntity body, vector pos, vector force) | Applies constant force on a position | |
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse) | Applies impuls on a rigidbody (origin) | more… |
proto void dBodyApplyImpulseAt(notnull IEntity body, vector impulse, vector pos) | Applies impuls on a pos position in world coordinates | more… |
proto native void dBodyApplyTorque(notnull IEntity body, vector torque) | ||
proto native void dBodyApplyTorqueImpulse(notnull IEntity ent, vector torqueImpulse) | ||
proto native dBlock dBodyCollisionBlock(notnull IEntity ent1, notnull IEntity ent2) | Disables collisions between two entities | |
proto native float dBodyComputeAngularImpulseDenominator(notnull IEntity ent, vector axis) | ||
proto native float dBodyComputeImpulseDenominator(notnull IEntity ent, vector position, vector normal) | ||
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 | more… |
proto bool dBodyCreateGhostEx(notnull IEntity ent, PhysicsGeomDef geoms[]) | ||
proto bool dBodyCreateStaticEx(notnull IEntity ent, PhysicsGeomDef geoms[]) | Creates RigidBody from custom made geometries. The geometries are deleted when rigid body is destroyed | more… |
proto native void dBodyDestroy(notnull IEntity ent) | Destroys attached physics body | more… |
proto native void dBodyDynamic(notnull IEntity ent, bool dynamic) | more… | |
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 | more… |
proto native bool dBodyEnableGravity(notnull IEntity ent, bool enable) | ||
proto vector dBodyGetAngularVelocity(notnull IEntity body) | Gets angular velocity for a rigidbody | more… |
proto native vector dBodyGetCenterOfMass(notnull IEntity body) | returns center of mass offset | |
proto native void dBodyGetDirectWorldTransform(notnull IEntity body, out vector matrix[4]) | ||
proto native int dBodyGetGeomInteractionLayer(notnull IEntity ent, int index) | ||
proto native int dBodyGetInteractionLayer(notnull IEntity ent) | more… | |
proto native vector dBodyGetInvInertiaDiagLocal(notnull IEntity ent) | ||
proto void dBodyGetInvInertiaTensorWorld(notnull IEntity body, out vector inertiaTensorWS[3]) | ||
proto native float dBodyGetKineticEnergy(notnull IEntity body) | ||
proto native vector dBodyGetLocalInertia(notnull IEntity ent) | ||
proto native float dBodyGetMass(notnull IEntity ent) | more… | |
proto native vector dBodyGetVelocityAt(notnull IEntity body, vector globalpos) | more… | |
proto native void dBodyGetWorldTransform(notnull IEntity body, out vector matrix[4]) | more… | |
proto native bool dBodyIsActive(notnull IEntity ent) | more… | |
proto native bool dBodyIsDynamic(notnull IEntity ent) | more… | |
proto native bool dBodyIsSet(notnull IEntity ent) | Has the entity attached physics body? | more… |
proto native bool dBodyIsSolid(notnull IEntity ent) | ||
proto native void dBodyRemoveBlock(notnull IEntity worldEntity, dBlock block) | ||
proto void dBodySetAngularVelocity(notnull IEntity body, vector angvel) | Changed an angular velocity | more… |
proto native void dBodySetDamping(notnull IEntity ent, float linearDamping, float angularDamping) | ||
proto native void dBodySetGeomInteractionLayer(notnull IEntity ent, int index, int mask) | ||
proto native void dBodySetInertiaTensorM(notnull IEntity body, vector m[3]) | ||
proto native void dBodySetInertiaTensorV(notnull IEntity body, vector v) | ||
proto native void dBodySetInteractionLayer(notnull IEntity ent, int mask) | ||
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 | |
proto native void dBodySetMass(notnull IEntity body, float mass) | more… | |
proto native void dBodySetSleepingTreshold(notnull IEntity body, float linearTreshold, float angularTreshold) | ||
proto native void dBodySetSolid(notnull IEntity ent, bool solid) | ||
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 | |
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… |
Function Documentation
dBodyActive
proto native void dBodyActive(notnull IEntity ent, ActiveState activeState)dBodyApplyImpulse
Applies impuls on a rigidbody (origin)
dBodyApplyImpulseAt
Applies impuls on a pos position in world coordinates
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
centerOfMass- Offset from object-pivot to center of mass
mass- Body mass
geoms- array of custom made geometries
autoptr PhysicsGeomDef geoms[] = {PhysicsGeomDef("", dGeomCreateBox(size), "material/default", 0xffffffff)};
dBodyCreateDynamicEx(this, center, 1.0, geoms);Referenced by ScriptModel.ScriptModel()
dBodyCreateStaticEx
proto bool dBodyCreateStaticEx(notnull IEntity ent, PhysicsGeomDef geoms[])Creates RigidBody from custom made geometries. The geometries are deleted when rigid body is destroyed
geoms- array of custom made geometries
autoptr PhysicsGeomDef geoms[] = {PhysicsGeomDef("", dGeomCreateBox(size), "material/default", 0xffffffff)};
dBodyCreateStaticEx(this, geoms);dBodyDynamic
Referenced by ScriptModel.ScriptModel()
dBodyEnableCCD
If both maxMotion and shapeCastRadius is >=0 then the continuous collision detection is enabled. If you want to disable it, use -1
maxMotion- max 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
sphereCastRadius- The radius of the largest possible sphere, that is completelly inside the body geometry.
dBodyGetAngularVelocity
Gets angular velocity for a rigidbody
Referenced by DayZPlayerCamera3rdPersonVehicle.OnUpdate()
dBodyGetInteractionLayer
dBodyGetMass
Referenced by ActionPushCarCB.ApplyForce(), ActionPushObjectCB.ApplyForce(), CarScript.CheckContactCache()
Show 1 more
, Transport.GetMomentum()dBodyGetVelocityAt
dBodyGetWorldTransform
dBodyIsActive
dBodyIsDynamic
dBodyIsSet
Has the entity attached physics body?
dBodySetAngularVelocity
Changed an angular velocity
bodyRigidbodyangvelAngularvelocity, rotation around x, y and z axis (not yaw/pitch/roll)
Referenced by DeveloperTeleport.SetPlayerPosition()
dBodySetMass
Referenced by ScriptModel.ScriptModel()
GetVelocity
Returns linear velocity
entIEntityentity which origin will be setmatvector[4]matrix to be set
Returns: vector linear velocity
Man player = g_Game.GetPlayer();
Print( GetVelocity(player) );
>> <0,0,0>Referenced by BoatHud.GetSpeedometer(), BoatScript.EOnPostSimulate(), BoatScript.OnContact()
Show 9 more
, CarScript.CheckContactCache(), CarScript.EOnPostSimulate(), CarScript.OnContact(), DayZCreatureAI.ModCommandHandlerBefore(), DayZPlayerCamera3rdPersonVehicle.OnUpdate(), EntityAI.RegisterTransportHit(), MiscGameplayFunctions.ThrowAllItemsInInventory(), Transport.GetMomentum(), and Weapon_Base.LiftWeaponCheckEx()SetVelocity
Sets linear velocity (for Rigid bodies)
ententitywhich velocity will be setvelvelocityvector to be set