Skip to content

Class: MockPhysicsShell ​

Mock of the X-Ray engine physics shell.

Implements ​

  • physics_shell

Constructors ​

Constructor ​

ts
new MockPhysicsShell(): MockPhysicsShell;

Returns ​

MockPhysicsShell

Methods ​

create() ​

ts
static create(): MockPhysicsShell;

Returns ​

MockPhysicsShell


mock() ​

ts
static mock(): physics_shell;

Returns ​

physics_shell

Properties ​

angularVelocity ​

ts
angularVelocity: MockVector;

apply_force ​

ts
apply_force: Mock<(x: number, y: number, z: number) => void>;

Apply force to the shell.

Param ​

x

Force x component.

Param ​

y

Force y component.

Param ​

z

Force z component.

Implementation of ​

ts
physics_shell.apply_force

block_breaking ​

ts
block_breaking: Mock<() => void>;

Prevent shell elements and joints from breaking.

Implementation of ​

ts
physics_shell.block_breaking

elements ​

ts
elements: physics_element[] = [];

elementsByBoneId ​

ts
elementsByBoneId: Map<number, physics_element>;

elementsByBoneName ​

ts
elementsByBoneName: Map<string, physics_element>;

force ​

ts
force: MockVector;

get_angular_vel ​

ts
get_angular_vel: Mock<(velocity: vector) => void>;

Write current angular velocity into a vector.

Remarks ​

The passed vector is overwritten with the root element's angular velocity.

Param ​

velocity

Output vector.

Implementation of ​

ts
physics_shell.get_angular_vel

get_element_by_bone_id ​

ts
get_element_by_bone_id: Mock<(id: number) => physics_element>;

Get an element by model bone id.

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.

Param ​

id

Bone id.

Returns ​

Matching physics element.

Implementation of ​

ts
physics_shell.get_element_by_bone_id

get_element_by_bone_name ​

ts
get_element_by_bone_name: Mock<(name: string) => physics_element>;

Get an element by model bone name.

Remarks ​

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

Param ​

bone_name

Bone name.

Returns ​

Matching physics element.

Implementation of ​

ts
physics_shell.get_element_by_bone_name

get_element_by_order ​

ts
get_element_by_order: Mock<(order: number) => physics_element>;

Get an element by shell storage order.

Remarks ​

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

Param ​

order

Element order.

Returns ​

Matching physics element.

Implementation of ​

ts
physics_shell.get_element_by_order

get_elements_number ​

ts
get_elements_number: Mock<() => number>;

Returns ​

Number of elements in the shell.

Implementation of ​

ts
physics_shell.get_elements_number

get_joint_by_bone_id ​

ts
get_joint_by_bone_id: Mock<(id: number) => physics_joint>;

Get a joint by model bone id.

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.

Param ​

id

Bone id.

Returns ​

Matching physics joint.

Implementation of ​

ts
physics_shell.get_joint_by_bone_id

get_joint_by_bone_name ​

ts
get_joint_by_bone_name: Mock<(name: string) => physics_joint>;

Get a joint by model bone name.

Remarks ​

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

Param ​

name

Bone name.

Returns ​

Matching physics joint.

Implementation of ​

ts
physics_shell.get_joint_by_bone_name

get_joint_by_order ​

ts
get_joint_by_order: Mock<(order: number) => physics_joint>;

Get a joint by shell storage order.

Remarks ​

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

Param ​

order

Joint order.

Returns ​

Matching physics joint.

Implementation of ​

ts
physics_shell.get_joint_by_order

get_joints_number ​

ts
get_joints_number: Mock<() => number>;

Returns ​

Number of joints in the shell.

Implementation of ​

ts
physics_shell.get_joints_number

get_linear_vel ​

ts
get_linear_vel: Mock<(velocity: vector) => void>;

Write current linear velocity into a vector.

Remarks ​

The passed vector is overwritten with the root element's linear velocity.

Param ​

velocity

Output vector.

Implementation of ​

ts
physics_shell.get_linear_vel

is_breakable ​

ts
is_breakable: Mock<() => boolean>;

Returns ​

Whether the shell can break.

Implementation of ​

ts
physics_shell.is_breakable

is_breaking_blocked ​

ts
is_breaking_blocked: Mock<() => boolean>;

Returns ​

Whether breaking is currently blocked.

Implementation of ​

ts
physics_shell.is_breaking_blocked

isBreakable ​

ts
isBreakable: boolean = false;

isBreakingBlocked ​

ts
isBreakingBlocked: boolean = false;

joints ​

ts
joints: physics_joint[] = [];

jointsByBoneId ​

ts
jointsByBoneId: Map<number, physics_joint>;

jointsByBoneName ​

ts
jointsByBoneName: Map<string, physics_joint>;

linearVelocity ​

ts
linearVelocity: MockVector;

unblock_breaking ​

ts
unblock_breaking: Mock<() => void>;

Allow shell elements and joints to break again.

Implementation of ​

ts
physics_shell.unblock_breaking