PhysicsImpostor

Hierarchy

  • PhysicsImpostor

Index

Constructors

constructor

Find examples in Playground
  • 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

Find examples in Playground
afterStep: function

this function is executed by the physics engine

Type declaration

    • (): void
    • Returns void

beforeStep

Find examples in Playground
beforeStep: function

this function is executed by the physics engine.

Type declaration

    • (): void
    • Returns void

friction

Find examples in Playground
friction: number

Sets the coefficient of friction

isDisposed

Find examples in Playground
isDisposed: boolean

Specifies if the physics imposter is disposed

mass

Find examples in Playground
mass: number

Gets the mass of the physics imposter

object

Find examples in Playground

The physics-enabled object used as the physics imposter

onCollide

Find examples in Playground
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

Find examples in Playground
onCollideEvent: Nullable<function>

Legacy collision detection event support

parent

Find examples in Playground

Sets the parent of the physics imposter

physicsBody

Find examples in Playground
physicsBody: any

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

restitution

Find examples in Playground
restitution: number

Sets the coefficient of restitution

type

Find examples in Playground
type: number

The type of the physics imposter

uniqueId

Find examples in Playground
uniqueId: number

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

Static BoxImpostor

Find examples in Playground
BoxImpostor: number

Box-Imposter type

Static CylinderImpostor

Find examples in Playground
CylinderImpostor: number

Cylinder-Imposter type

Static DEFAULT_OBJECT_SIZE

Find examples in Playground
DEFAULT_OBJECT_SIZE: Vector3

The default object size of the imposter

Static HeightmapImpostor

Find examples in Playground
HeightmapImpostor: number

Heightmap-Imposter type

Static IDENTITY_QUATERNION

Find examples in Playground
IDENTITY_QUATERNION: Quaternion

The identity quaternion of the imposter

Static MeshImpostor

Find examples in Playground
MeshImpostor: number

Mesh-imposter type

Static NoImpostor

Find examples in Playground
NoImpostor: number

No-Imposter type

Static ParticleImpostor

Find examples in Playground
ParticleImpostor: number

Particle-Imposter type

Static PlaneImpostor

Find examples in Playground
PlaneImpostor: number

Plane-Imposter type

Static SphereImpostor

Find examples in Playground
SphereImpostor: number

Sphere-Imposter type

Methods

addJoint

Find examples in Playground
  • Add a joint to this impostor with a different impostor

    Parameters

    Returns PhysicsImpostor

    The physics imposter

applyForce

Find examples in Playground
  • Apply a force

    Parameters

    • force: Vector3

      The force to apply

    • contactPoint: Vector3

      The contact point for the force

    Returns PhysicsImpostor

    The physics imposter

applyImpulse

Find examples in Playground
  • Apply an impulse

    Parameters

    • force: Vector3

      The impulse force

    • contactPoint: Vector3

      The contact point for the impulse force

    Returns PhysicsImpostor

    The physics imposter

clone

Find examples in Playground

createJoint

Find examples in Playground
  • 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

Find examples in Playground
  • dispose(): void
  • Disposes the physics imposter

    Returns void

executeNativeFunction

Find examples in Playground
  • 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

Find examples in Playground
  • 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

Find examples in Playground
  • Gets the angular velocity

    Returns Nullable<Vector3>

    angular velocity or null

getBoxSizeToRef

Find examples in Playground
  • 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

Find examples in Playground
  • Gets the linear velocity

    Returns Nullable<Vector3>

    linear velocity or null

getObjectCenter

Find examples in Playground
  • Gets the object center

    Returns Vector3

    The object center

getObjectExtendSize

Find examples in Playground
  • Gets the object extend size

    Returns Vector3

    the object extend size

getParam

Find examples in Playground
  • 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

Find examples in Playground
  • Get the parent rotation

    Returns Quaternion

    The parent rotation

getRadius

Find examples in Playground
  • getRadius(): number
  • Gets the radius of the physics imposter

    Returns number

    Radius of the physics imposter

isBodyInitRequired

Find examples in Playground
  • isBodyInitRequired(): boolean
  • Should a new body be generated.

    Returns boolean

    boolean specifying if body initialization is required

registerAfterPhysicsStep

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

    Parameters

    Returns void

registerBeforePhysicsStep

Find examples in Playground
  • 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

Find examples in Playground

resetUpdateFlags

Find examples in Playground
  • resetUpdateFlags(): void
  • Resets the update flags

    Returns void

setAngularVelocity

Find examples in Playground
  • Sets the angular velocity

    Parameters

    Returns void

setDeltaPosition

Find examples in Playground
  • setDeltaPosition(position: Vector3): void
  • Sets the delta position

    Parameters

    • position: Vector3

      The delta position amount

    Returns void

setDeltaRotation

Find examples in Playground
  • Sets the delta rotation

    Parameters

    Returns void

setLinearVelocity

Find examples in Playground
  • Sets the linear velocity

    Parameters

    Returns void

setMass

Find examples in Playground
  • 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

Find examples in Playground
  • 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

Find examples in Playground
  • setScalingUpdated(updated: boolean): void
  • Sets the updated scaling

    Parameters

    • updated: boolean

      Specifies if the scaling is updated

    Returns void

sleep

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

    Returns PhysicsImpostor

    the physics imposter

syncBoneWithImpostor

Find examples in Playground
  • 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

Find examples in Playground
  • 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

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

    Parameters

    Returns void

unregisterBeforePhysicsStep

Find examples in Playground
  • 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

Find examples in Playground

wakeUp

Find examples in Playground

Generated using TypeDoc