Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • PhysicsImpostor

Index

Constructors

  • Initializes the physics imposter

    Parameters

    • object: IPhysicsEnabledObject

      The physics-enabled object used as the physics imposter

    • type: number

      The type of the physics imposter. Types are available as static members of this class.

    • Optional _options: PhysicsImpostorParameters

      The options for the physics imposter

    • Optional _scene: Scene

      The Babylon scene

    Returns PhysicsImpostor

Properties

afterStep: () => void

Type declaration

    • (): void
    • this function is executed by the physics engine

      Returns void

beforeStep: () => void

Type declaration

    • (): void
    • this function is executed by the physics engine.

      Returns void

The physics-enabled object used as the physics imposter

onCollide: (e: { body: any; point: Nullable<Vector3> }) => void

Type declaration

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

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

Box-Imposter type

CapsuleImpostor: number

Capsule-Impostor type (Ammo.js plugin only)

ClothImpostor: number

Cloth-Imposter type

ConvexHullImpostor: number

ConvexHull-Impostor type (Ammo.js plugin only)

CustomImpostor: number

Custom-Imposter type (Ammo.js plugin only)

CylinderImpostor: number

Cylinder-Imposter type

DEFAULT_OBJECT_SIZE: Vector3

The default object size of the imposter

HeightmapImpostor: number

Heightmap-Imposter type

IDENTITY_QUATERNION: Quaternion

The identity quaternion of the imposter

MeshImpostor: number

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

NoImpostor: number

No-Imposter type

ParticleImpostor: number

Particle-Imposter type

PlaneImpostor: number

Plane-Imposter type

RopeImpostor: number

Rope-Imposter type

SoftbodyImpostor: number

Softbody-Imposter type

SphereImpostor: number

Sphere-Imposter type

Accessors

  • get friction(): number
  • set friction(value: number): void
  • Gets the coefficient of friction

    Returns number

  • Sets the coefficient of friction

    Parameters

    • value: number

    Returns void

  • get isDisposed(): boolean
  • Specifies if the physics imposter is disposed

    Returns boolean

  • get mass(): number
  • set mass(value: number): void
  • Gets the mass of the physics imposter

    Returns number

  • Gets the mass of the physics imposter

    Parameters

    • value: number

    Returns void

  • Get the parent of the physics imposter

    Returns Nullable<PhysicsImpostor>

    Physics imposter or null

  • Sets the parent of the physics imposter

    Parameters

    Returns void

    Physics imposter or null

  • get physicsBody(): any
  • set physicsBody(physicsBody: any): void
  • Gets the body that holds this impostor. Either its own, or its parent.

    Returns any

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

    Parameters

    • physicsBody: any

    Returns void

  • get positionIterations(): number
  • set positionIterations(value: number): void
  • Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin

    Returns number

  • Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin

    Parameters

    • value: number

    Returns void

  • get pressure(): number
  • set pressure(value: number): void
  • Gets the pressure of a soft body; only supported by the AmmoJSPlugin

    Returns number

  • Sets the pressure of a soft body; only supported by the AmmoJSPlugin

    Parameters

    • value: number

    Returns void

  • get restitution(): number
  • set restitution(value: number): void
  • Gets the coefficient of restitution

    Returns number

  • Sets the coefficient of restitution

    Parameters

    • value: number

    Returns void

  • get stiffness(): number
  • set stiffness(value: number): void
  • Gets the stiffness of a soft body; only supported by the AmmoJSPlugin

    Returns number

  • Sets the stiffness of a soft body; only supported by the AmmoJSPlugin

    Parameters

    • value: number

    Returns void

  • get velocityIterations(): number
  • set velocityIterations(value: number): void
  • Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin

    Returns number

  • Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin

    Parameters

    • value: number

    Returns void

Methods

  • 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

  • Add a joint to this impostor with a different impostor

    Parameters

    Returns PhysicsImpostor

    The physics imposter

  • Apply a force

    Parameters

    • force: Vector3

      The force to apply

    • contactPoint: Vector3

      The contact point for the force

    Returns PhysicsImpostor

    The physics imposter

  • Apply an impulse

    Parameters

    • force: Vector3

      The impulse force

    • contactPoint: Vector3

      The contact point for the impulse force

    Returns PhysicsImpostor

    The physics imposter

  • Clones the physics imposter

    Parameters

    Returns Nullable<PhysicsImpostor>

    A nullable physics imposter

  • 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(): void
  • Disposes the physics imposter

    Returns void

  • executeNativeFunction(func: (world: any, physicsBody: any) => void): 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: (world: any, physicsBody: any) => void

      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(): 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

  • Gets the angular velocity

    Returns Nullable<Vector3>

    angular velocity or null

  • 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

  • Gets the linear velocity

    Returns Nullable<Vector3>

    linear velocity or null

  • Gets the object center

    Returns Vector3

    The object center

  • Gets the object extend size

    Returns Vector3

    the object extend size

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

    Parameters

    • paramName: string

      The object parameter name

    Returns any

    The object parameter

  • Get the parent rotation

    Returns Quaternion

    The parent rotation

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

    Returns number

    Radius of the physics imposter

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

    Returns boolean

    boolean specifying if body initialization is required

  • Register a function that will be executed after the physics step

    Parameters

    Returns void

  • Register a function that will be executed before the physics world is stepping forward

    Parameters

    Returns void

  • resetUpdateFlags(): void
  • Resets the update flags

    Returns void

  • Sets the angular velocity

    Parameters

    Returns void

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

    Parameters

    • position: Vector3

      The delta position amount

    Returns void

  • Sets the delta rotation

    Parameters

    Returns void

  • Sets the linear velocity

    Parameters

    Returns void

  • 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(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(): void
  • Sets the updated scaling

    Returns void

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

    Returns PhysicsImpostor

    the physics imposter

  • 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

  • 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(func: (impostor: PhysicsImpostor) => void): void
  • Unregisters a function that will be executed after the physics step

    Parameters

    Returns void

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

    Parameters

    Returns void

  • Wake the body up.

    Returns PhysicsImpostor

    The physics imposter

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Static property
  • Static method
  • Inherited constructor

Settings

Theme