API

Class PhysicsImpostor

Represents a physics imposter

Index

The physics-enabled object used as the physics imposter

onCollideEvent: Nullable<
    (collider: PhysicsImpostor, collidedWith: PhysicsImpostor) => void,
> = null

Legacy collision detection event support

type: number

The type of the physics imposter

uniqueId: number

The unique id of the physics imposter set by the physics engine when adding this impostor to the array

BoxImpostor: number = 2

Box-Imposter type

CapsuleImpostor: number = 6

Capsule-Impostor type (Ammo.js plugin only)

ClothImpostor: number = 102

Cloth-Imposter type

ConvexHullImpostor: number = 10

ConvexHull-Impostor type (Ammo.js plugin only)

CustomImpostor: number = 100

Custom-Imposter type (Ammo.js plugin only)

CylinderImpostor: number = 7

Cylinder-Imposter type

DEFAULT_OBJECT_SIZE: Vector3 = ...

The default object size of the imposter

HeightmapImpostor: number = 9

Heightmap-Imposter type

IDENTITY_QUATERNION: Quaternion = ...

The identity quaternion of the imposter

MeshImpostor: number = 4

Mesh-imposter type (Only available to objects with vertices data)

NoImpostor: number = 0

No-Imposter type

ParticleImpostor: number = 8

Particle-Imposter type

PlaneImpostor: number = 3

Plane-Imposter type

RopeImpostor: number = 101

Rope-Imposter type

SoftbodyImpostor: number = 103

Softbody-Imposter type

SphereImpostor: number = 1

Sphere-Imposter type

  • Add an anchor to a cloth impostor

    Parameters

    • otherImpostor: PhysicsImpostor

      rigid impostor to anchor to

    • width: number

      ratio across width from 0 to 1

    • height: number

      ratio up height from 0 to 1

    • influence: number

      the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little stretch

    • noCollisionBetweenLinkedBodies: boolean

      when true collisions between cloth impostor and anchor are ignored; default false

    Returns PhysicsImpostor

    impostor the soft imposter

  • Add a hook to a rope impostor

    Parameters

    • otherImpostor: PhysicsImpostor

      rigid impostor to anchor to

    • length: number

      ratio across rope from 0 to 1

    • influence: number

      the elasticity between rope impostor and anchor from 0, very stretchy to 1, little stretch

    • noCollisionBetweenLinkedBodies: boolean

      when true collisions between soft impostor and anchor are ignored; default false

    Returns PhysicsImpostor

    impostor the rope imposter

  • Execute a function with the physics plugin native code Provide a function the will have two variables - the world object and the physics body object

    Parameters

    • func: (world: any, physicsBody: any) => void

      The function to execute with the physics plugin native code

    Returns void

  • Sync a bone with this impostor

    Parameters

    • bone: Bone

      The bone to sync to the impostor.

    • boneMesh: AbstractMesh

      The mesh that the bone is influencing.

    • jointPivot: Vector3

      The pivot of the joint / bone in local space.

    • OptionaldistToJoint: number

      Optional distance from the impostor to the joint.

    • OptionaladjustRotation: Quaternion

      Optional quaternion for adjusting the local rotation of the bone.

    Returns void

  • Sync impostor to a bone

    Parameters

    • bone: Bone

      The bone that the impostor will be synced to.

    • boneMesh: AbstractMesh

      The mesh that the bone is influencing.

    • jointPivot: Vector3

      The pivot of the joint / bone in local space.

    • OptionaldistToJoint: number

      Optional distance from the impostor to the joint.

    • OptionaladjustRotation: Quaternion

      Optional quaternion for adjusting the local rotation of the bone.

    • OptionalboneAxis: Vector3

      Optional vector3 axis the bone is aligned with

    Returns void