Class AmmoJSPlugin
Hierarchy
- AmmoJSPlugin
Implements
- IPhysicsEnginePlugin
Index
Constructors
Properties
Methods
- append
Anchor - append
Hook - apply
Force - apply
Impulse - dispose
- execute
Step - generate
Joint - generate
Physics Body - get
Angular Velocity - get
Body Friction - get
Body Mass - get
Body Position Iterations - get
Body Pressure - get
Body Restitution - get
Body Stiffness - get
Body Velocity Iterations - get
Box Size To Ref - get
Linear Velocity - get
Radius - get
Time Step - is
Supported - raycast
- remove
Joint - remove
Physics Body - set
Angular Velocity - set
Body Friction - set
Body Mass - set
Body Position Iterations - set
Body Pressure - set
Body Restitution - set
Body Stiffness - set
Body Velocity Iterations - set
Fixed Time Step - set
Gravity - set
Limit - set
Linear Velocity - set
Max Steps - set
Motor - set
Physics Body Transformation - set
Time Step - set
Transformation From Physics Body - sleep
Body - sync
Mesh With Impostor - update
Distance Joint - wake
Up Body
Constructors
constructor
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
bjsAMMOSearch playground for bjsAMMO
Reference to the Ammo library
nameSearch playground for name
Name of the plugin
on Create Custom Convex Hull ImpostorSearch playground for onCreateCustomConvexHullImpostor
Type declaration
The create custom convex hull impostor handler function to support building custom convex hull impostor vertex data
Parameters
impostor: PhysicsImpostor
Returns any
on Create Custom Mesh ImpostorSearch playground for onCreateCustomMeshImpostor
Type declaration
The create custom mesh impostor handler function to support building custom mesh impostor vertex data
Parameters
impostor: PhysicsImpostor
Returns any
on Create Custom ShapeSearch playground for onCreateCustomShape
Type declaration
The create custom shape handler function to be called when using BABYLON.PhysicsImposter.CustomImpostor
Parameters
impostor: PhysicsImpostor
Returns any
worldSearch playground for world
Created ammoJS world which physics bodies are added to
Methods
append AnchorSearch playground for appendAnchor
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
append HookSearch playground for appendHook
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
apply ForceSearch playground for applyForce
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
apply ImpulseSearch playground for applyImpulse
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
disposeSearch playground for dispose
Disposes of the impostor
Returns void
execute StepSearch playground for executeStep
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
generate JointSearch playground for generateJoint
Generates a joint
Parameters
impostorJoint: PhysicsImpostorJoint
the imposter joint to create the joint with
Returns void
generate Physics BodySearch playground for generatePhysicsBody
Creates a physics body using the plugin
Parameters
impostor: PhysicsImpostor
the imposter to create the physics body on
Returns void
get Angular VelocitySearch playground for getAngularVelocity
gets the angular velocity
Parameters
impostor: PhysicsImpostor
imposter to get angular velocity from
Returns Nullable<Vector3>
angular velocity
get Body FrictionSearch playground for getBodyFriction
Gets friction of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get friction from
Returns number
friction value
get Body MassSearch playground for getBodyMass
Gets the mass of the physics body
Parameters
impostor: PhysicsImpostor
imposter to get the mass from
Returns number
mass
get Body Position IterationsSearch playground for getBodyPositionIterations
Gets positionIterations of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get position iterations from
Returns number
positionIterations value
get Body PressureSearch playground for getBodyPressure
Gets pressure inside the impostor
Parameters
impostor: PhysicsImpostor
impostor to get pressure from
Returns number
pressure value
get Body RestitutionSearch playground for getBodyRestitution
Gets restitution of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get restitution from
Returns number
restitution value
get Body StiffnessSearch playground for getBodyStiffness
Gets stiffness of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get stiffness from
Returns number
pressure value
get Body Velocity IterationsSearch playground for getBodyVelocityIterations
Gets velocityIterations of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get velocity iterations from
Returns number
velocityIterations value
get Box Size To RefSearch playground for getBoxSizeToRef
Gets the box size of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get box size from
result: Vector3
the resulting box size
Returns void
get Linear VelocitySearch playground for getLinearVelocity
gets the linear velocity
Parameters
impostor: PhysicsImpostor
imposter to get linear velocity from
Returns Nullable<Vector3>
linear velocity
get RadiusSearch playground for getRadius
Gets the radius of the impostor
Parameters
impostor: PhysicsImpostor
impostor to get radius from
Returns number
the radius
get Time StepSearch playground for getTimeStep
Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)
Returns number
the current timestep in seconds
is SupportedSearch playground for isSupported
If this plugin is supported
Returns boolean
true if its supported
raycastSearch playground for raycast
Does a raycast in the physics world
Parameters
Returns PhysicsRaycastResult
PhysicsRaycastResult
remove JointSearch playground for removeJoint
Removes a joint
Parameters
impostorJoint: PhysicsImpostorJoint
the imposter joint to remove the joint from
Returns void
remove Physics BodySearch playground for removePhysicsBody
Removes the physics body from the imposter and disposes of the body's memory
Parameters
impostor: PhysicsImpostor
imposter to remove the physics body from
Returns void
set Angular VelocitySearch playground for setAngularVelocity
Sets the angular velocity of the physics body
Parameters
impostor: PhysicsImpostor
imposter to set the velocity on
velocity: Vector3
velocity to set
Returns void
set Body FrictionSearch playground for setBodyFriction
Sets friction of the impostor
Parameters
impostor: PhysicsImpostor
impostor to set friction on
friction: number
friction value
Returns void
set Body MassSearch playground for setBodyMass
Sets the mass of physics body
Parameters
impostor: PhysicsImpostor
imposter to set the mass on
mass: number
mass to set
Returns void
set Body Position IterationsSearch playground for setBodyPositionIterations
Sets positionIterations of the impostor
Parameters
impostor: PhysicsImpostor
impostor to set position on
positionIterations: number
positionIterations value
Returns void
set Body PressureSearch playground for setBodyPressure
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
set Body RestitutionSearch playground for setBodyRestitution
Sets restitution of the impostor
Parameters
impostor: PhysicsImpostor
impostor to set resitution on
restitution: number
resitution value
Returns void
set Body StiffnessSearch playground for setBodyStiffness
Sets stiffness of the impostor
Parameters
impostor: PhysicsImpostor
impostor to set stiffness on
stiffness: number
stiffness value from 0 to 1
Returns void
set Body Velocity IterationsSearch playground for setBodyVelocityIterations
Sets velocityIterations of the impostor
Parameters
impostor: PhysicsImpostor
impostor to set velocity iterations on
velocityIterations: number
velocityIterations value
Returns void
set Fixed Time StepSearch playground for setFixedTimeStep
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
set GravitySearch playground for setGravity
Sets the gravity of the physics world (m/(s^2))
Parameters
gravity: Vector3
Gravity to set
Returns void
set LimitSearch playground for setLimit
Sets the motors limit
Returns void
set Linear VelocitySearch playground for setLinearVelocity
Sets the linear velocity of the physics body
Parameters
impostor: PhysicsImpostor
imposter to set the velocity on
velocity: Vector3
velocity to set
Returns void
set Max StepsSearch playground for setMaxSteps
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
set MotorSearch playground for setMotor
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
set Physics Body TransformationSearch playground for setPhysicsBodyTransformation
Sets the babylon object's position/rotation from the physics body's position/rotation
Parameters
impostor: PhysicsImpostor
imposter containing the physics body and babylon object
newPosition: Vector3
new position
newRotation: Quaternion
new rotation
Returns void
set Time StepSearch playground for setTimeStep
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
set Transformation From Physics BodySearch playground for setTransformationFromPhysicsBody
Sets the mesh body position/rotation from the babylon impostor
Parameters
impostor: PhysicsImpostor
imposter containing the physics body and babylon object
Returns void
sleep BodySearch playground for sleepBody
Sleeps the physics body and stops it from being active
Parameters
impostor: PhysicsImpostor
impostor to sleep
Returns void
sync Mesh With ImpostorSearch playground for syncMeshWithImpostor
Syncs the position and rotation of a mesh with the impostor
Parameters
mesh: AbstractMesh
mesh to sync
impostor: PhysicsImpostor
impostor to update the mesh with
Returns void
update Distance JointSearch playground for updateDistanceJoint
Updates the distance parameters of the joint
Returns void
wake Up BodySearch playground for wakeUpBody
Activates the physics body
Parameters
impostor: PhysicsImpostor
impostor to activate
Returns void
AmmoJS Physics plugin
https://doc.babylonjs.com/how_to/using_the_physics_engine
https://github.com/kripken/ammo.js/