Header menu logo Nu

WorldPhysics Module

Physics functions for the world.

Type extensions

Type extension Description

World.applyBodyAngularImpulse angularImpulse bodyId world

Full Usage: World.applyBodyAngularImpulse angularImpulse bodyId world

Parameters:

Send a physics message to apply angular impulse to a body with the given body id.

Extended Type: World

angularImpulse : Vector3
bodyId : BodyId
world : World

World.applyBodyForce force originWorldOpt bodyId world

Full Usage: World.applyBodyForce force originWorldOpt bodyId world

Parameters:

Send a physics message to apply force to a body with the given body id.

Extended Type: World

force : Vector3
originWorldOpt : Vector3 option
bodyId : BodyId
world : World

World.applyBodyLinearImpulse linearImpulse originWorldOpt bodyId world

Full Usage: World.applyBodyLinearImpulse linearImpulse originWorldOpt bodyId world

Parameters:

Send a physics message to apply linear impulse to a body with the given body id.

Extended Type: World

linearImpulse : Vector3
originWorldOpt : Vector3 option
bodyId : BodyId
world : World

World.applyBodyTorque torque bodyId world

Full Usage: World.applyBodyTorque torque bodyId world

Parameters:

Send a physics message to apply torque to a body with the given body id.

Extended Type: World

torque : Vector3
bodyId : BodyId
world : World

World.createBodies is2d bodySource bodiesProperties world

Full Usage: World.createBodies is2d bodySource bodiesProperties world

Parameters:

Send a physics message to create several physics bodies.

Extended Type: World

is2d : bool
bodySource : Simulant
bodiesProperties : BodyProperties list
world : World

World.createBody is2d bodyId bodyProperties world

Full Usage: World.createBody is2d bodyId bodyProperties world

Parameters:

Send a physics message to create a physics body.

Extended Type: World

is2d : bool
bodyId : BodyId
bodyProperties : BodyProperties
world : World

World.createBodyJoint is2d bodyJointSource bodyJointProperties world

Full Usage: World.createBodyJoint is2d bodyJointSource bodyJointProperties world

Parameters:

Send a physics message to create a physics joint.

Extended Type: World

is2d : bool
bodyJointSource : Simulant
bodyJointProperties : BodyJointProperties
world : World

World.destroyBodies is2d bodyIds world

Full Usage: World.destroyBodies is2d bodyIds world

Parameters:

Send a physics message to destroy several physics bodies.

Extended Type: World

is2d : bool
bodyIds : BodyId list
world : World

World.destroyBody is2d bodyId world

Full Usage: World.destroyBody is2d bodyId world

Parameters:

Send a physics message to destroy a physics body.

Extended Type: World

is2d : bool
bodyId : BodyId
world : World

World.destroyBodyJoint is2d bodyJointTarget bodyJointTarget2Opt bodyJointId world

Full Usage: World.destroyBodyJoint is2d bodyJointTarget bodyJointTarget2Opt bodyJointId world

Parameters:

Send a physics message to destroy a physics joint.

Extended Type: World

is2d : bool
bodyJointTarget : BodyId
bodyJointTarget2Opt : BodyId option
bodyJointId : BodyJointId
world : World

World.getBodyAngularVelocity bodyId world

Full Usage: World.getBodyAngularVelocity bodyId world

Parameters:
Returns: Vector3

Get the angular velocity of the body with the given body id.

Extended Type: World

bodyId : BodyId
world : World
Returns: Vector3

World.getBodyContactNormals bodyId world

Full Usage: World.getBodyContactNormals bodyId world

Parameters:
Returns: Vector3 array

Get the contact normals of the body with the given body id.

Extended Type: World

bodyId : BodyId
world : World
Returns: Vector3 array

World.getBodyExists bodyId world

Full Usage: World.getBodyExists bodyId world

Parameters:
Returns: bool

Check that the world contains a body with the given body id.

Extended Type: World

bodyId : BodyId
world : World
Returns: bool

World.getBodyGrounded bodyId world

Full Usage: World.getBodyGrounded bodyId world

Parameters:
Returns: bool

Check that the body with the given body id is on the ground.

Extended Type: World

bodyId : BodyId
world : World
Returns: bool

World.getBodyLinearVelocity bodyId world

Full Usage: World.getBodyLinearVelocity bodyId world

Parameters:
Returns: Vector3

Get the linear velocity of the body with the given body id.

Extended Type: World

bodyId : BodyId
world : World
Returns: Vector3

World.getBodySensor bodyId world

Full Usage: World.getBodySensor bodyId world

Parameters:
Returns: bool

Check that the body with the given body id is a sensor.

Extended Type: World

bodyId : BodyId
world : World
Returns: bool

World.getBodyToGroundContactNormalOpt bodyId world

Full Usage: World.getBodyToGroundContactNormalOpt bodyId world

Parameters:
Returns: Vector3 option

Get a contact normal where the body with the given body id is touching the ground (if one exists).

Extended Type: World

bodyId : BodyId
world : World
Returns: Vector3 option

World.getBodyToGroundContactNormals bodyId world

Full Usage: World.getBodyToGroundContactNormals bodyId world

Parameters:
Returns: Vector3 array

Get the contact normals where the body with the given body id is touching the ground.

Extended Type: World

bodyId : BodyId
world : World
Returns: Vector3 array

World.getBodyToGroundContactTangentOpt bodyId world

Full Usage: World.getBodyToGroundContactTangentOpt bodyId world

Parameters:
Returns: Vector3 option

Get a contact tangent where the body with the given body id is touching the ground (if one exists).

Extended Type: World

bodyId : BodyId
world : World
Returns: Vector3 option

World.getBodyWheelAngularVelocity wheelIndex bodyId world

Full Usage: World.getBodyWheelAngularVelocity wheelIndex bodyId world

Parameters:
Returns: single

Extended Type: World

wheelIndex : int
bodyId : BodyId
world : World
Returns: single

World.getBodyWheelModelMatrix wheelModelRight wheelModelUp wheelIndex bodyId world

Full Usage: World.getBodyWheelModelMatrix wheelModelRight wheelModelUp wheelIndex bodyId world

Parameters:
Returns: Matrix4x4

Extended Type: World

wheelModelRight : Vector3
wheelModelUp : Vector3
wheelIndex : int
bodyId : BodyId
world : World
Returns: Matrix4x4

World.getBodyWheelSpeedAtClutch bodyId world

Full Usage: World.getBodyWheelSpeedAtClutch bodyId world

Parameters:
Returns: single

Extended Type: World

bodyId : BodyId
world : World
Returns: single

World.handlePhysicsMessage2d message world

Full Usage: World.handlePhysicsMessage2d message world

Parameters:

Handle a 2d physics message in the world.

Extended Type: World

message : PhysicsMessage
world : World

World.handlePhysicsMessage3d message world

Full Usage: World.handlePhysicsMessage3d message world

Parameters:

Send a 3d physics message in the world.

Extended Type: World

message : PhysicsMessage
world : World

World.handlePhysicsMessages2d messages world

Full Usage: World.handlePhysicsMessages2d messages world

Parameters:

Send multiple 2d physics messages to the world.

Extended Type: World

messages : PhysicsMessage seq
world : World

World.handlePhysicsMessages3d messages world

Full Usage: World.handlePhysicsMessages3d messages world

Parameters:

Send multiple 3d physics messages to the world.

Extended Type: World

messages : PhysicsMessage seq
world : World

World.jumpBody canJumpInAir jumpSpeed bodyId world

Full Usage: World.jumpBody canJumpInAir jumpSpeed bodyId world

Parameters:
    canJumpInAir : bool
    jumpSpeed : single
    bodyId : BodyId
    world : World

Send a physics message to jump to a body with the given body id (KinematicCharacter only).

Extended Type: World

canJumpInAir : bool
jumpSpeed : single
bodyId : BodyId
world : World

World.localizePrimitiveBodyShape size bodyShape

Full Usage: World.localizePrimitiveBodyShape size bodyShape

Parameters:
Returns: BodyShape

Localize a primitive body shape to a specific size; non-primitive body shapes are unaffected.

Extended Type: World

size : Vector3
bodyShape : BodyShape
Returns: BodyShape

World.rayCast2dBodies ray collisionMask closestOnly world

Full Usage: World.rayCast2dBodies ray collisionMask closestOnly world

Parameters:
    ray : Ray3
    collisionMask : int
    closestOnly : bool
    world : World

Returns: BodyIntersection array

Ray cast against 2d physics bodies.

Extended Type: World

ray : Ray3
collisionMask : int
closestOnly : bool
world : World
Returns: BodyIntersection array

World.rayCast3dBodies ray collisionMask closestOnly world

Full Usage: World.rayCast3dBodies ray collisionMask closestOnly world

Parameters:
    ray : Ray3
    collisionMask : int
    closestOnly : bool
    world : World

Returns: BodyIntersection array

Ray cast against 3d physics bodies.

Extended Type: World

ray : Ray3
collisionMask : int
closestOnly : bool
world : World
Returns: BodyIntersection array

World.reloadPhysicsAssets world

Full Usage: World.reloadPhysicsAssets world

Parameters:

Reload all currently selected physics assets.

Extended Type: World

world : World

World.reregisterPhysics world

Full Usage: World.reregisterPhysics world

Parameters:

Reregister all currently selected 3d physics.

Extended Type: World

world : World

World.setBodyAngularVelocity angularVelocity bodyId world

Full Usage: World.setBodyAngularVelocity angularVelocity bodyId world

Parameters:

Send a physics message to set the angular velocity of a body with the given body id.

Extended Type: World

angularVelocity : Vector3
bodyId : BodyId
world : World

World.setBodyCenter center bodyId world

Full Usage: World.setBodyCenter center bodyId world

Parameters:

Send a physics message to set the position of a body with the given body id.

Extended Type: World

center : Vector3
bodyId : BodyId
world : World

World.setBodyEnabled enabled bodyId world

Full Usage: World.setBodyEnabled enabled bodyId world

Parameters:

Send a physics message to set the enabled-ness of a body with the given body id.

Extended Type: World

enabled : bool
bodyId : BodyId
world : World

World.setBodyLinearVelocity linearVelocity bodyId world

Full Usage: World.setBodyLinearVelocity linearVelocity bodyId world

Parameters:

Send a physics message to set the linear velocity of a body with the given body id.

Extended Type: World

linearVelocity : Vector3
bodyId : BodyId
world : World

World.setBodyRotation rotation bodyId world

Full Usage: World.setBodyRotation rotation bodyId world

Parameters:

Send a physics message to set the rotation of a body with the given body id.

Extended Type: World

rotation : Quaternion
bodyId : BodyId
world : World

World.setBodyVehicleBrakeInput brakeInput bodyId world

Full Usage: World.setBodyVehicleBrakeInput brakeInput bodyId world

Parameters:

Send a physics message to set the brake input of a vehicle body with the given body id.

Extended Type: World

brakeInput : single
bodyId : BodyId
world : World

World.setBodyVehicleForwardInput forwardInput bodyId world

Full Usage: World.setBodyVehicleForwardInput forwardInput bodyId world

Parameters:

Send a physics message to set the forward input of a vehicle body with the given body id.

Extended Type: World

forwardInput : single
bodyId : BodyId
world : World

World.setBodyVehicleHandBrakeInput handBrakeInput bodyId world

Full Usage: World.setBodyVehicleHandBrakeInput handBrakeInput bodyId world

Parameters:
    handBrakeInput : single
    bodyId : BodyId
    world : World

Send a physics message to set the hand brake input of a vehicle body with the given body id.

Extended Type: World

handBrakeInput : single
bodyId : BodyId
world : World

World.setBodyVehicleRightInput rightInput bodyId world

Full Usage: World.setBodyVehicleRightInput rightInput bodyId world

Parameters:

Send a physics message to set the right input of a vehicle body with the given body id.

Extended Type: World

rightInput : single
bodyId : BodyId
world : World

Type something to start searching.