Class: physics_element
One rigid body element inside a physics shell.
Source
src/xrPhysics/PhysicsShellScript.cpp, physics_element binding.
Custom Constructor
physics_element
Remarks
Scripts normally receive elements from a physics_shell; they are live engine objects, not standalone values. Keep them only while the owning shell and object are alive.
Methods
apply_force()
ts
apply_force(
x: number,
y: number,
z: number): void;Apply force to the element.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Force x component. |
y | number | Force y component. |
z | number | Force z component. |
Returns
void
fix()
ts
fix(): void;Fix the element in place.
Returns
void
get_angular_vel()
ts
get_angular_vel(velocity: vector): void;Write current angular velocity into a vector.
Parameters
| Parameter | Type | Description |
|---|---|---|
velocity | vector | Output vector. |
Returns
void
Remarks
The passed vector is overwritten.
get_density()
ts
get_density(): number;Returns
number
Element density.
get_linear_vel()
ts
get_linear_vel(velocity: vector): void;Write current linear velocity into a vector.
Parameters
| Parameter | Type | Description |
|---|---|---|
velocity | vector | Output vector. |
Returns
void
Remarks
The passed vector is overwritten.
get_mass()
ts
get_mass(): number;Returns
number
Element mass.
get_volume()
ts
get_volume(): number;Returns
number
Element volume.
global_transform()
ts
global_transform(): matrix;Returns
Current global transform.
is_breakable()
ts
is_breakable(): boolean;Returns
boolean
Whether the element can break.
is_fixed()
ts
is_fixed(): boolean;Returns
boolean
Whether the element is fixed.
release_fixed()
ts
release_fixed(): void;Release a fixed element.
Returns
void