Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • AmmoJSPlugin

Implements

  • IPhysicsEnginePlugin

Index

Constructors

  • new AmmoJSPlugin(_useDeltaForWorldStep?: boolean, ammoInjection?: any, overlappingPairCache?: any): AmmoJSPlugin
  • Initializes the ammoJS plugin

    Parameters

    • Optional _useDeltaForWorldStep: boolean

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

    • Optional ammoInjection: any

      can be used to inject your own ammo reference

    • Optional overlappingPairCache: any

      can be used to specify your own overlapping pair cache

    Returns AmmoJSPlugin

Properties

bjsAMMO: any

Reference to the Ammo library

name: string

Name of the plugin

onCreateCustomConvexHullImpostor: ((impostor: PhysicsImpostor) => any)

Type declaration

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

      Parameters

      Returns any

onCreateCustomMeshImpostor: ((impostor: PhysicsImpostor) => any)

Type declaration

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

      Parameters

      Returns any

onCreateCustomShape: ((impostor: PhysicsImpostor) => any)

Type declaration

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

      Parameters

      Returns any

world: any

Created ammoJS world which physics bodies are added to

Methods

  • appendAnchor(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void
  • 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

    • Optional influence: number

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

    • Optional noCollisionBetweenLinkedBodies: boolean

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

    Returns void

  • appendHook(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): 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

    • Optional influence: number

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

    • Optional noCollisionBetweenLinkedBodies: boolean

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

    Returns void

  • Applies a force on the imposter

    Parameters

    • impostor: PhysicsImpostor

      imposter to apply force

    • force: Vector3

      amount of force to be applied to the imposter

    • contactPoint: Vector3

      the location to apply the force on the imposter

    Returns void

  • Applies an impulse on the imposter

    Parameters

    • impostor: PhysicsImpostor

      imposter to apply impulse to

    • force: Vector3

      amount of force to be applied to the imposter

    • contactPoint: Vector3

      the location to apply the impulse on the imposter

    Returns void

  • dispose(): void
  • Disposes of the impostor

    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

  • Generates a joint

    Parameters

    Returns void

  • Creates a physics body using the plugin

    Parameters

    Returns void

  • gets the angular velocity

    Parameters

    Returns Nullable<Vector3>

    angular velocity

  • Gets friction of the impostor

    Parameters

    Returns number

    friction value

  • Gets the mass of the physics body

    Parameters

    Returns number

    mass

  • Gets positionIterations of the impostor

    Parameters

    Returns number

    positionIterations value

  • Gets pressure inside the impostor

    Parameters

    Returns number

    pressure value

  • Gets restitution of the impostor

    Parameters

    Returns number

    restitution value

  • Gets stiffness of the impostor

    Parameters

    Returns number

    pressure value

  • Gets velocityIterations of the impostor

    Parameters

    Returns number

    velocityIterations value

  • Gets the box size of the impostor

    Parameters

    Returns void

  • gets the linear velocity

    Parameters

    Returns Nullable<Vector3>

    linear velocity

  • getPluginVersion(): number
  • Returns number

    plugin version

  • Gets the radius of the impostor

    Parameters

    Returns number

    the radius

  • getTimeStep(): number
  • Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)

    Returns number

    the current timestep in seconds

  • isSupported(): boolean
  • If this plugin is supported

    Returns boolean

    true if its supported

  • Does a raycast in the physics world

    Parameters

    • from: Vector3

      where should the ray start?

    • to: Vector3

      where should the ray end?

    Returns PhysicsRaycastResult

    PhysicsRaycastResult

  • Does a raycast in the physics world

    Parameters

    Returns void

  • Removes a joint

    Parameters

    Returns void

  • Removes the physics body from the imposter and disposes of the body's memory

    Parameters

    Returns void

  • Sets the angular velocity of the physics body

    Parameters

    Returns void

  • Sets friction of the impostor

    Parameters

    • impostor: PhysicsImpostor

      impostor to set friction on

    • friction: number

      friction value

    Returns void

  • Sets the mass of physics body

    Parameters

    • impostor: PhysicsImpostor

      imposter to set the mass on

    • mass: number

      mass to set

    Returns void

  • setBodyPositionIterations(impostor: PhysicsImpostor, positionIterations: number): void
  • Sets positionIterations of the impostor

    Parameters

    • impostor: PhysicsImpostor

      impostor to set position on

    • positionIterations: number

      positionIterations value

    Returns void

  • Sets pressure inside a soft body impostor Cloth and rope must remain 0 pressure

    Parameters

    • impostor: PhysicsImpostor

      impostor to set pressure on

    • pressure: number

      pressure value

    Returns void

  • Sets restitution of the impostor

    Parameters

    • impostor: PhysicsImpostor

      impostor to set resitution on

    • restitution: number

      resitution value

    Returns void

  • Sets stiffness of the impostor

    Parameters

    • impostor: PhysicsImpostor

      impostor to set stiffness on

    • stiffness: number

      stiffness value from 0 to 1

    Returns void

  • setBodyVelocityIterations(impostor: PhysicsImpostor, velocityIterations: number): void
  • Sets velocityIterations of the impostor

    Parameters

    • impostor: PhysicsImpostor

      impostor to set velocity iterations on

    • velocityIterations: number

      velocityIterations value

    Returns void

  • setFixedTimeStep(fixedTimeStep: number): 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

  • Sets the gravity of the physics world (m/(s^2))

    Parameters

    Returns void

  • setLimit(): void
  • Sets the motors limit

    Returns void

  • Sets the linear velocity of the physics body

    Parameters

    Returns void

  • setMaxSteps(maxSteps: number): void
  • Sets the maximum number of steps by the physics engine per frame (Default: 5)

    Parameters

    • maxSteps: number

      the maximum number of steps by the physics engine per frame

    Returns void

  • Sets a motor on the joint

    Parameters

    • joint: IMotorEnabledJoint

      joint to set motor on

    • Optional speed: number

      speed of the motor

    • Optional maxForce: number

      maximum force of the motor

    Returns void

  • Sets the babylon object's position/rotation from the physics body's position/rotation

    Parameters

    Returns void

  • setTimeStep(timeStep: number): 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

  • Sets the mesh body position/rotation from the babylon impostor

    Parameters

    • impostor: PhysicsImpostor

      imposter containing the physics body and babylon object

    Returns void

  • Sleeps the physics body and stops it from being active

    Parameters

    Returns void

  • Syncs the position and rotation of a mesh with the impostor

    Parameters

    Returns void

  • updateDistanceJoint(): void
  • Updates the distance parameters of the joint

    Returns void

  • Activates the physics body

    Parameters

    Returns void

Legend

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

Settings

Theme