@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / PhysicsComponent
Class: PhysicsComponent ​
Defined in: components/Physics.ts:387
Marker base class for every ECS component. Subclass Component to declare a typed data container that systems can query.
Remarks ​
Components own state only — runtime behaviour belongs in Behaviour subclasses for user scripts. Keep fields plain (numbers, strings, vectors, asset URLs).
Extends ​
Constructors ​
Constructor ​
ts
new PhysicsComponent(values?): PhysicsComponent;Defined in: components/Physics.ts:405
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:389 |
pendingVelocity? | PendingBodyVelocity | null | Velocity to apply the moment this body becomes dynamic again. Non-enumerable, like the Rapier refs — never serialized. | components/Physics.ts:395 |
rigidBody | RigidBody | null | Live Rapier rigid body. null until physics is initialized. NON-ENUMERABLE — Rapier wrappers (and, for trimesh, their vertex buffers) must never leak into snapshots/history/debug walks. | components/Physics.ts:401 |
collider | Collider | null | Live Rapier collider. null until physics is initialized. NON-ENUMERABLE. | components/Physics.ts:403 |
Methods ​
setValues() ​
ts
setValues(patch): void;Defined in: components/Physics.ts:416
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

