PhysicsImpostor

Hierarchy

  • PhysicsImpostor

Index

Constructors

constructor

  • Initializes the physics imposter

    Parameters

    • object: IPhysicsEnabledObject

      The physics-enabled object used as the physics imposter

    • type: number

      The type of the physics imposter

    • Optional _options: PhysicsImpostorParameters

      The options for the physics imposter

    • Optional _scene: Scene | undefined

      The Babylon scene

    Returns PhysicsImpostor

Properties

afterStep

afterStep: function

this function is executed by the physics engine

Type declaration

    • (): void
    • Returns void

beforeStep

beforeStep: function

this function is executed by the physics engine.

Type declaration

    • (): void
    • Returns void

friction

friction: number

Sets the coefficient of friction

isDisposed

isDisposed: boolean

Specifies if the physics imposter is disposed

mass

mass: number

Gets the mass of the physics imposter

object

The physics-enabled object used as the physics imposter

onCollide

onCollide: function

event and body object due to cannon's event-based architecture.

Type declaration

    • (e: object): void
    • Parameters

      • e: object
        • body: any

      Returns void

onCollideEvent

onCollideEvent: Nullable<function>

Legacy collision detection event support

parent

Sets the parent of the physics imposter

physicsBody

physicsBody: any

Set the physics body. Used mainly by the physics engine/plugin

restitution

restitution: number

Sets the coefficient of restitution

type

type: number

The type of the physics imposter

uniqueId

uniqueId: number

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

Static BoxImpostor

BoxImpostor: number

Box-Imposter type

Static CylinderImpostor

CylinderImpostor: number

Cylinder-Imposter type

Static DEFAULT_OBJECT_SIZE

DEFAULT_OBJECT_SIZE: Vector3

The default object size of the imposter

Static HeightmapImpostor

HeightmapImpostor: number

Heightmap-Imposter type

Static IDENTITY_QUATERNION

IDENTITY_QUATERNION: Quaternion

The identity quaternion of the imposter

Static MeshImpostor

MeshImpostor: number

Mesh-imposter type

Static NoImpostor

NoImpostor: number

No-Imposter type

Static ParticleImpostor

ParticleImpostor: number

Particle-Imposter type

Static PlaneImpostor

PlaneImpostor: number

Plane-Imposter type

Static SphereImpostor

SphereImpostor: number

Sphere-Imposter type

Methods

addJoint

  • Add a joint to this impostor with a different impostor

    Parameters

    Returns PhysicsImpostor

    The physics imposter

applyForce

  • Apply a force

    Parameters

    • force: Vector3

      The force to apply

    • contactPoint: Vector3

      The contact point for the force

    Returns PhysicsImpostor

    The physics imposter

applyImpulse

  • Apply an impulse

    Parameters

    • force: Vector3

      The impulse force

    • contactPoint: Vector3

      The contact point for the impulse force

    Returns PhysicsImpostor

    The physics imposter

clone

  • Clones the physics imposter

    Parameters

    Returns Nullable<PhysicsImpostor>

    A nullable physics imposter

createJoint

  • A help function to create a joint

    Parameters

    • otherImpostor: PhysicsImpostor

      A physics imposter used to create a joint

    • jointType: number

      The type of joint

    • jointData: PhysicsJointData

      The data for the joint

    Returns PhysicsImpostor

    The physics imposter

dispose

  • dispose(): void
  • Disposes the physics imposter

    Returns void

executeNativeFunction

  • executeNativeFunction(func: function): void
  • 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: function

      The function to execute with the physics plugin native code

        • (world: any, physicsBody: any): void
        • Parameters

          • world: any
          • physicsBody: any

          Returns void

    Returns void

forceUpdate

  • forceUpdate(): void
  • Force a regeneration of this or the parent's impostor's body. Use under cautious - This will remove all joints already implemented.

    Returns void

getAngularVelocity

  • Gets the angular velocity

    Returns Nullable<Vector3>

    angular velocity or null

getBoxSizeToRef

  • Gets the box size of the physics imposter and stores the result in the input parameter

    Parameters

    • result: Vector3

      Stores the box size

    Returns PhysicsImpostor

    The physics imposter

getLinearVelocity

  • Gets the linear velocity

    Returns Nullable<Vector3>

    linear velocity or null

getObjectCenter

  • Gets the object center

    Returns Vector3

    The object center

getObjectExtendSize

  • Gets the object extend size

    Returns Vector3

    the object extend size

getParam

  • getParam(paramName: string): any
  • Get a specific parametes from the options parameter

    Parameters

    • paramName: string

      The object parameter name

    Returns any

    The object parameter

getParentsRotation

  • Get the parent rotation

    Returns Quaternion

    The parent rotation

getRadius

  • getRadius(): number
  • Gets the radius of the physics imposter

    Returns number

    Radius of the physics imposter

isBodyInitRequired

  • isBodyInitRequired(): boolean
  • Should a new body be generated.

    Returns boolean

    boolean specifying if body initialization is required

registerAfterPhysicsStep

  • registerAfterPhysicsStep(func: function): void
  • Register a function that will be executed after the physics step

    Parameters

    Returns void

registerBeforePhysicsStep

  • registerBeforePhysicsStep(func: function): void
  • Register a function that will be executed before the physics world is stepping forward

    Parameters

    • func: function

      The function to execute before the physics world is stepped forward

    Returns void

registerOnPhysicsCollide

  • register a function that will be executed when this impostor collides against a different body

    Parameters

    Returns void

resetUpdateFlags

  • resetUpdateFlags(): void
  • Resets the update flags

    Returns void

setAngularVelocity

  • Sets the angular velocity

    Parameters

    Returns void

setDeltaPosition

  • setDeltaPosition(position: Vector3): void
  • Sets the delta position

    Parameters

    • position: Vector3

      The delta position amount

    Returns void

setDeltaRotation

  • Sets the delta rotation

    Parameters

    Returns void

setLinearVelocity

  • Sets the linear velocity

    Parameters

    Returns void

setMass

  • setMass(mass: number): void
  • Specifically change the body's mass option. Won't recreate the physics body object

    Parameters

    • mass: number

      The mass of the physics imposter

    Returns void

setParam

  • setParam(paramName: string, value: number): void
  • Sets a specific parameter in the options given to the physics plugin

    Parameters

    • paramName: string

      The parameter name

    • value: number

      The value of the parameter

    Returns void

setScalingUpdated

  • setScalingUpdated(updated: boolean): void
  • Sets the updated scaling

    Parameters

    • updated: boolean

      Specifies if the scaling is updated

    Returns void

sleep

  • Will keep this body still, in a sleep mode.

    Returns PhysicsImpostor

    the physics imposter

syncBoneWithImpostor

  • 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.

    • Optional distToJoint: number

      Optional distance from the impostor to the joint.

    • Optional adjustRotation: Quaternion

      Optional quaternion for adjusting the local rotation of the bone.

    Returns void

syncImpostorWithBone

  • 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.

    • Optional distToJoint: number

      Optional distance from the impostor to the joint.

    • Optional adjustRotation: Quaternion

      Optional quaternion for adjusting the local rotation of the bone.

    • Optional boneAxis: Vector3

      Optional vector3 axis the bone is aligned with

    Returns void

unregisterAfterPhysicsStep

  • unregisterAfterPhysicsStep(func: function): void
  • Unregisters a function that will be executed after the physics step

    Parameters

    Returns void

unregisterBeforePhysicsStep

  • unregisterBeforePhysicsStep(func: function): void
  • Unregister a function that will be executed before the physics world is stepping forward

    Parameters

    • func: function

      The function to execute before the physics world is stepped forward

    Returns void

unregisterOnPhysicsCollide

wakeUp

  • Wake the body up.

    Returns PhysicsImpostor

    The physics imposter

Generated using TypeDoc