@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / PhysicsComponent
Class: PhysicsComponent
Defined in: components/Physics.ts:350
Unified physics component combining a Rapier rigid body and a Rapier collider into a single authoring and runtime container.
Use values.rigidbody to configure body type, mass, damping, locks, etc. Use values.collider to configure collider shape, size, offset, material properties, and sensor mode.
The runtime rigidBody and collider references are created by the physics system when the project loads and are null until physics is initialized.
Extends
Constructors
Constructor
new PhysicsComponent(values?): PhysicsComponent;Defined in: components/Physics.ts:358
Parameters
| Parameter | Type |
|---|---|
values? | { rigidbody?: Partial<RigidbodyState>; collider?: Partial<ColliderState>; } |
values.rigidbody? | Partial<RigidbodyState> |
values.collider? | Partial<ColliderState> |
Returns
PhysicsComponent
Overrides
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
values | PhysicsState | Authoring state. Saved with the project. | components/Physics.ts:352 |
rigidBody | RigidBody | null | Live Rapier rigid body. null until physics is initialized. | components/Physics.ts:354 |
collider | Collider | null | Live Rapier collider. null until physics is initialized. | components/Physics.ts:356 |
Methods
setValues()
setValues(patch): void;Defined in: components/Physics.ts:369
Patch rigidbody and/or collider state. Each sub-object is deep-merged with the current values via the respective normalizer.
Parameters
| Parameter | Type |
|---|---|
patch | { rigidbody?: Partial<RigidbodyState>; collider?: Partial<ColliderState>; } |
patch.rigidbody? | Partial<RigidbodyState> |
patch.collider? | Partial<ColliderState> |
Returns
void

