Class: RigidbodyManager
Creates and updates rigidbody components.
Constructors
Constructor
new RigidbodyManager(): RigidbodyManager;
Returns
RigidbodyManager
Methods
Create()
static Create(entity): Promise<boolean>;
Creates a rigidbody component on an entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
Returns
Promise<boolean>
A promise that resolves to true if the rigidbody component was
created, or false otherwise.
Destroy()
static Destroy(entity): Promise<boolean>;
Removes a rigidbody component from an entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
Returns
Promise<boolean>
A promise that resolves to true if the rigidbody component was
removed, or false otherwise.
HasComponent()
static HasComponent(entity): Promise<boolean>;
Checks whether an entity has a rigidbody component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<boolean>
A promise that resolves to true if the entity has a rigidbody
component, or false otherwise.
GetLinearVelocity()
static GetLinearVelocity(entity): Promise<vec3>;
Gets the linear velocity of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<vec3>
A promise that resolves to the linear velocity in meters per second.
GetAngularVelocity()
static GetAngularVelocity(entity): Promise<vec3>;
Gets the angular velocity of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<vec3>
A promise that resolves to the angular velocity in radians per second.
AddForce()
static AddForce(
entity,
force,
forceMode?): Promise<void>;
Adds force to a rigidbody.
The force is expressed in newtons for ForceMode.Force, meters per second squared for ForceMode.Acceleration, newton-seconds for ForceMode.Impulse, and meters per second for ForceMode.VelocityChange.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
force | vec3 | The force vector. |
forceMode? | ForceMode | The force application mode. Defaults to ForceMode.Force. |
Returns
Promise<void>
A promise that resolves when the force has been applied.
AddForceAtPosition()
static AddForceAtPosition(
entity,
force,
position,
forceMode?): Promise<boolean>;
Adds force to a rigidbody at a world position.
The force is expressed in newtons for ForceMode.Force, meters per second squared for ForceMode.Acceleration, newton-seconds for ForceMode.Impulse, and meters per second for ForceMode.VelocityChange.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
force | vec3 | The force vector. |
position | vec3 | The world position where the force is applied, in meters. |
forceMode? | ForceMode | The force application mode. Defaults to ForceMode.Force. |
Returns
Promise<boolean>
A promise that resolves to true if the force was applied, or
false otherwise.
AddTorque()
static AddTorque(
entity,
torque,
forceMode?): Promise<void>;
Adds torque to a rigidbody.
The torque is expressed in newton-meters for ForceMode.Force, radians per second squared for ForceMode.Acceleration, newton-meter-seconds for ForceMode.Impulse, and radians per second for ForceMode.VelocityChange.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
torque | vec3 | The torque vector. |
forceMode? | ForceMode | The force application mode. Defaults to ForceMode.Force. |
Returns
Promise<void>
A promise that resolves when the torque has been applied.
GetIsKinematic()
static GetIsKinematic(entity): Promise<boolean>;
Gets whether a rigidbody is kinematic.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<boolean>
A promise that resolves to true if the rigidbody is kinematic, or
false otherwise.
SetIsKinematic()
static SetIsKinematic(entity, isKinematic): Promise<void>;
Sets whether a rigidbody is kinematic.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
isKinematic | boolean | Whether the rigidbody is kinematic. |
Returns
Promise<void>
A promise that resolves when the kinematic setting has been changed.
GetUseGravity()
static GetUseGravity(entity): Promise<boolean>;
Gets whether a rigidbody uses gravity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<boolean>
A promise that resolves to true if the rigidbody uses gravity, or
false otherwise.
SetUseGravity()
static SetUseGravity(entity, useGravity): Promise<void>;
Sets whether a rigidbody uses gravity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
useGravity | boolean | Whether the rigidbody uses gravity. |
Returns
Promise<void>
A promise that resolves when the gravity setting has been changed.
GetMass()
static GetMass(entity): Promise<number>;
Gets the mass of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<number>
A promise that resolves to the mass in kilograms.
SetMass()
static SetMass(entity, mass): Promise<void>;
Sets the mass of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
mass | number | The mass in kilograms. |
Returns
Promise<void>
A promise that resolves when the mass has been changed.
GetLinearDamping()
static GetLinearDamping(entity): Promise<number>;
Gets the linear damping of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<number>
A promise that resolves to the linear damping.
SetLinearDamping()
static SetLinearDamping(entity, linearDamping): Promise<void>;
Sets the linear damping of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
linearDamping | number | The linear damping. |
Returns
Promise<void>
A promise that resolves when the linear damping has been changed.
GetAngularDamping()
static GetAngularDamping(entity): Promise<number>;
Gets the angular damping of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<number>
A promise that resolves to the angular damping.
SetAngularDamping()
static SetAngularDamping(entity, angularDamping): Promise<void>;
Sets the angular damping of a rigidbody.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
angularDamping | number | The angular damping. |
Returns
Promise<void>
A promise that resolves when the angular damping has been changed.