API Reference

Class List

RigidBodyComponentSystem

Extends: ComponentSystem

The RigidBodyComponentSystem maintains the dynamics world for simulating rigid bodies, it also controls global values for the world such as gravity. Note: The RigidBodyComponentSystem is only valid if 3D Physics is enabled in your application. You can enable this in the application settings for your project.

Summary

Properties

gravity

The world space vector representing global gravity in the physics simulation.

Methods

raycastAll

Raycast the world and return all entities the ray hits.

raycastFirst

Raycast the world and return the first entity the ray hits.

Events

contact

Fired when a contact occurs between two rigid bodies.

Inherited

Details

Constructor

RigidBodyComponentSystem(app)

Create a new RigidBodyComponentSystem.

Parameters

appApplication

The Application.

Properties

Vec3gravity

The world space vector representing global gravity in the physics simulation. Defaults to [0, -9.81, 0] which is an approximation of the gravitational force on Earth.

Methods

raycastAll(start, end)

Raycast the world and return all entities the ray hits. It returns an array of RaycastResult, one for each hit. If no hits are detected, the returned array will be of length 0.

Parameters

startVec3

The world space point where the ray starts.

endVec3

The world space point where the ray ends.

Returns

RaycastResult[]

An array of raycast hit results (0 length if there were no hits).

raycastFirst(start, end)

Raycast the world and return the first entity the ray hits. Fire a ray into the world from start to end, if the ray hits an entity with a collision component, it returns a RaycastResult, otherwise returns null.

Parameters

startVec3

The world space point where the ray starts.

endVec3

The world space point where the ray ends.

Returns

RaycastResult

The result of the raycasting or null if there was no hit.

Events

contact

Fired when a contact occurs between two rigid bodies.

Parameters

resultSingleContactResult

Details of the contact between the two bodies.

Inherited