API Reference

Class List

pc.RigidBodyComponentSystem

Extends: pc.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 Depot.

Summary

Methods

raycastFirstRaycast the world and return the first entity the ray hits.
setGravitySet the gravity vector for the 3D physics world
setGravity^2Set the gravity vector for the 3D physics world

Events

contactFired when a contact occurs between two rigid bodies

Inherited

Details

Constructor

RigidBodyComponentSystem(app)

Create a new RigidBodyComponentSystem

Parameters

apppc.ApplicationThe Application

Methods

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 rigidbody component, it returns a pc.RaycastResult, otherwise returns null.

Parameters

startpc.Vec3The world space point where the ray starts
endpc.Vec3The world space point where the ray ends

Returns

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

setGravity(x, y, z)

Set the gravity vector for the 3D physics world

Parameters

xNumberThe x-component of the gravity vector
yNumberThe y-component of the gravity vector
zNumberThe z-component of the gravity vector

setGravity^2(gravity)

Set the gravity vector for the 3D physics world

Parameters

gravitypc.Vec3The gravity vector to use for the 3D physics world.

Events

contact

Fired when a contact occurs between two rigid bodies

Parameters

resultpc.SingleContactResultDetails of the contact between the two bodies

Inherited