SixL client API / game/physics / GamePhysicsMp
Interface: GamePhysicsMp
The physics functions of objects and other entities.
Remarks
Getters are asynchronous: they return a Promise.
Example
mp.game.physics.activate(object);
Methods
activate()
activate(entity):void
Activates the physics of an entity, so that it reacts to forces (it falls, slides or is pushed).
Parameters
entity
number | { handle: number; }
The entity, or its handle.
Returns
void
Example
mp.game.physics.activate(object);
getCgoffset()
getCgoffset(entity):Promise<IVector3>
The centre of gravity of an entity, relative to the entity's position.
Parameters
entity
number | { handle: number; }
The entity, or its handle.
Returns
Promise<IVector3>
A Promise of the offset as { x, y, z } in metres.
Example
const { x, y, z } = await mp.game.physics.getCgoffset(vehicle);
ropeLoadTextures()
ropeLoadTextures(): void
Loads the textures that ropes are drawn with. Call it before ropes are created.
Returns
void
Example
mp.game.physics.ropeLoadTextures();
setDisableBreaking()
setDisableBreaking(object,toggle):void
Turns off the breaking of an object: it no longer breaks apart when hit.
Parameters
object
number | { handle: number; }
The object, or its handle.
toggle
boolean
true to disable breaking, false to allow it again.
Returns
void
Example
mp.game.physics.setDisableBreaking(object, true);
setDisableFragDamage()
setDisableFragDamage(object,toggle):void
Turns off the fragment damage of an object: its fragments are not separated by damage.
Parameters
object
number | { handle: number; }
The object, or its handle.
toggle
boolean
true to disable fragment damage, false to allow it again.
Returns
void
Example
mp.game.physics.setDisableFragDamage(object, true);
stopRopeWinding()
stopRopeWinding(ropeId):void
Stops a rope from being wound in or let out.
Parameters
ropeId
number
The rope's id.
Returns
void
Example
mp.game.physics.stopRopeWinding(ropeId);