Skip to content

Class: physics_shell ​

Physics shell made of elements and joints.

Source ​

src/xrPhysics/PhysicsShellScript.cpp, physics_shell binding.

Custom Constructor ​

physics_shell

Remarks ​

Shells are engine-owned. Store-order lookups require an index lower than the corresponding count method.

Methods ​

apply_force() ​

ts
apply_force(
   x: number, 
   y: number, 
   z: number): void;

Apply force to the shell.

Parameters ​

ParameterTypeDescription
xnumberForce x component.
ynumberForce y component.
znumberForce z component.

Returns ​

void


block_breaking() ​

ts
block_breaking(): void;

Prevent shell elements and joints from breaking.

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 with the root element's angular velocity.


get_element_by_bone_id() ​

ts
get_element_by_bone_id(id: number): physics_element;

Get an element by model bone id.

Parameters ​

ParameterTypeDescription
idnumberBone id.

Returns ​

physics_element

Matching physics element.

Remarks ​

Returns the element attached to the bone, if the shell has one for that id. Invalid ids can trip native assertions in debug builds.


get_element_by_bone_name() ​

ts
get_element_by_bone_name(bone_name: string): physics_element;

Get an element by model bone name.

Parameters ​

ParameterTypeDescription
bone_namestringBone name.

Returns ​

physics_element

Matching physics element.

Remarks ​

The bone name must exist in the shell's kinematics. Invalid names can trip native assertions in debug builds.


get_element_by_order() ​

ts
get_element_by_order(order: number): physics_element;

Get an element by shell storage order.

Parameters ​

ParameterTypeDescription
ordernumberElement order.

Returns ​

physics_element

Matching physics element.

Remarks ​

order must be lower than get_elements_number(); invalid values trip a native assertion.


get_elements_number() ​

ts
get_elements_number(): number;

Returns ​

number

Number of elements in the shell.


get_joint_by_bone_id() ​

ts
get_joint_by_bone_id(id: number): physics_joint;

Get a joint by model bone id.

Parameters ​

ParameterTypeDescription
idnumberBone id.

Returns ​

physics_joint

Matching physics joint.

Remarks ​

Returns the joint attached to the bone, if the shell has one for that id. Invalid ids can trip native assertions in debug builds.


get_joint_by_bone_name() ​

ts
get_joint_by_bone_name(name: string): physics_joint;

Get a joint by model bone name.

Parameters ​

ParameterTypeDescription
namestringBone name.

Returns ​

physics_joint

Matching physics joint.

Remarks ​

The bone name must exist in the shell's kinematics. Invalid names can trip native assertions in debug builds.


get_joint_by_order() ​

ts
get_joint_by_order(order: number): physics_joint;

Get a joint by shell storage order.

Parameters ​

ParameterTypeDescription
ordernumberJoint order.

Returns ​

physics_joint

Matching physics joint.

Remarks ​

order must be lower than get_joints_number(); invalid values trip a native assertion.


get_joints_number() ​

ts
get_joints_number(): number;

Returns ​

number

Number of joints in the shell.


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 with the root element's linear velocity.


is_breakable() ​

ts
is_breakable(): boolean;

Returns ​

boolean

Whether the shell can break.


is_breaking_blocked() ​

ts
is_breaking_blocked(): boolean;

Returns ​

boolean

Whether breaking is currently blocked.


unblock_breaking() ​

ts
unblock_breaking(): void;

Allow shell elements and joints to break again.

Returns ​

void