Skip to content

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 ​

ParameterTypeDescription
xnumberForce x component.
ynumberForce y component.
znumberForce 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 ​

ParameterTypeDescription
velocityvectorOutput 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 ​

ParameterTypeDescription
velocityvectorOutput 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 ​

matrix

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