API

Class AmmoJSPlugin

AmmoJS Physics plugin

Index
  • Initializes the ammoJS plugin

    Parameters

    • _useDeltaForWorldStep: boolean = true

      if the time between frames should be used when calculating physics steps (Default: true)

    • ammoInjection: any = Ammo

      can be used to inject your own ammo reference

    • overlappingPairCache: any = null

      can be used to specify your own overlapping pair cache

    Returns AmmoJSPlugin

bjsAMMO: any = {}

Reference to the Ammo library

name: string = "AmmoJSPlugin"

Name of the plugin

onCreateCustomConvexHullImpostor: (impostor: PhysicsImpostor) => any

The create custom convex hull impostor handler function to support building custom convex hull impostor vertex data

onCreateCustomMeshImpostor: (impostor: PhysicsImpostor) => any

The create custom mesh impostor handler function to support building custom mesh impostor vertex data

onCreateCustomShape: (impostor: PhysicsImpostor) => any

The create custom shape handler function to be called when using BABYLON.PhysicsImposter.CustomImpostor

world: any

Created ammoJS world which physics bodies are added to

  • Append an anchor to a cloth object

    Parameters

    • impostor: PhysicsImpostor

      is the cloth impostor to add anchor to

    • otherImpostor: PhysicsImpostor

      is the 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 = 1

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

    • noCollisionBetweenLinkedBodies: boolean = false

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

    Returns void

  • Append an hook to a rope object

    Parameters

    • impostor: PhysicsImpostor

      is the rope impostor to add hook to

    • otherImpostor: PhysicsImpostor

      is the rigid impostor to hook to

    • length: number

      ratio along the rope from 0 to 1

    • influence: number = 1

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

    • noCollisionBetweenLinkedBodies: boolean = false

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

    Returns void

  • Moves the physics simulation forward delta seconds and updates the given physics imposters Prior to the step the imposters physics location is set to the position of the babylon meshes After the step the babylon meshes are set to the position of the physics imposters

    Parameters

    • delta: number

      amount of time to step forward

    • impostors: PhysicsImpostor[]

      array of imposters to update before/after the step

    Returns void

  • Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)

    Parameters

    • fixedTimeStep: number

      fixedTimeStep to use in seconds

    Returns void

  • Amount of time to step forward on each frame (only used if useDeltaForWorldStep is false in the constructor)

    Parameters

    • timeStep: number

      timestep to use in seconds

    Returns void