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()
apply_force(
x: number,
y: number,
z: number): void;Apply force to the shell.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Force x component. |
y | number | Force y component. |
z | number | Force z component. |
Returns
void
block_breaking()
block_breaking(): void;Prevent shell elements and joints from breaking.
Returns
void
get_angular_vel()
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 with the root element's angular velocity.
get_element_by_bone_id()
get_element_by_bone_id(id: number): physics_element;Get an element by model bone id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | Bone id. |
Returns
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()
get_element_by_bone_name(bone_name: string): physics_element;Get an element by model bone name.
Parameters
| Parameter | Type | Description |
|---|---|---|
bone_name | string | Bone name. |
Returns
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()
get_element_by_order(order: number): physics_element;Get an element by shell storage order.
Parameters
| Parameter | Type | Description |
|---|---|---|
order | number | Element order. |
Returns
Matching physics element.
Remarks
order must be lower than get_elements_number(); invalid values trip a native assertion.
get_elements_number()
get_elements_number(): number;Returns
number
Number of elements in the shell.
get_joint_by_bone_id()
get_joint_by_bone_id(id: number): physics_joint;Get a joint by model bone id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | Bone id. |
Returns
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()
get_joint_by_bone_name(name: string): physics_joint;Get a joint by model bone name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Bone name. |
Returns
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()
get_joint_by_order(order: number): physics_joint;Get a joint by shell storage order.
Parameters
| Parameter | Type | Description |
|---|---|---|
order | number | Joint order. |
Returns
Matching physics joint.
Remarks
order must be lower than get_joints_number(); invalid values trip a native assertion.
get_joints_number()
get_joints_number(): number;Returns
number
Number of joints in the shell.
get_linear_vel()
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 with the root element's linear velocity.
is_breakable()
is_breakable(): boolean;Returns
boolean
Whether the shell can break.
is_breaking_blocked()
is_breaking_blocked(): boolean;Returns
boolean
Whether breaking is currently blocked.
unblock_breaking()
unblock_breaking(): void;Allow shell elements and joints to break again.
Returns
void