src/world/World.js:24
 The physics world
addbody
 
 Defined in
 src/world/World.js:238
 
Deprecated: Use .addBody instead
Add a rigid body to the simulation.
body
 Body 
 
 addConstraintc
 
 Defined in
 src/world/World.js:265
 
Add a constraint to the simulation.
addContactMaterialcmat
 
 Defined in
 src/world/World.js:413
 
Adds a contact material to the World
cmat
 ContactMaterial 
 
 addEventListenertype
 listener
 Inherited from
 EventTarget:
 src/utils/EventTarget.js:15
 
Add an event listener
type
 String
 
 listener
 Function
 
 The self object, for chainability.
addMaterialm
 
 Defined in
 src/world/World.js:403
 
Adds a material to the World.
m
 Material 
 
 dispatchEventevent
 Inherited from
 EventTarget:
 src/utils/EventTarget.js:68
 
Emit an event.
event
 Object
 
 type
 String
 
 The self object, for chainability.
getContactMaterialm1
 m2
 
 Defined in
 src/world/World.js:206
 
Get the contact material between materials m1 and m2
The contact material if it was found.
hasEventListenertype
 listener
 Inherited from
 EventTarget:
 src/utils/EventTarget.js:34
 
Check if an event listener is added
type
 String
 
 listener
 Function
 
 numObjects
 Defined in
 src/world/World.js:217
 
Get number of objects in the world.
raycastAllfrom
 to
 options
 callback
 
 Defined in
 src/world/World.js:308
 
Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.
True if any body was hit.
raycastAnyfrom
 to
 options
 result
 
 Defined in
 src/world/World.js:329
 
Ray cast, and stop at the first result. Note that the order is random - but the method is fast.
from
 Vec3 
 
 to
 Vec3 
 
 options
 Object
 
 [collisionFilterMask=-1]
 Number
 optional
 
 [collisionFilterGroup=-1]
 Number
 optional
 
 [skipBackfaces=false]
 Boolean
 optional
 
 [checkCollisionResponse=true]
 Boolean
 optional
 
 result
 RaycastResult 
 
 True if any body was hit.
raycastClosestfrom
 to
 options
 result
 
 Defined in
 src/world/World.js:350
 
Ray cast, and return information of the closest hit.
from
 Vec3 
 
 to
 Vec3 
 
 options
 Object
 
 [collisionFilterMask=-1]
 Number
 optional
 
 [collisionFilterGroup=-1]
 Number
 optional
 
 [skipBackfaces=false]
 Boolean
 optional
 
 [checkCollisionResponse=true]
 Boolean
 optional
 
 result
 RaycastResult 
 
 True if any body was hit.
rayTestfrom
 to
 result
 
 Defined in
 src/world/World.js:286
 
Deprecated: Use .raycastAll, .raycastClosest or .raycastAny instead.
Raycast test
from
 Vec3 
 
 to
 Vec3 
 
 result
 Function | RaycastResult 
 
 removebody
 
 Defined in
 src/world/World.js:371
 
Deprecated: Use .removeBody instead
Remove a rigid body from the simulation.
body
 Body 
 
 removeBodybody
 
 Defined in
 src/world/World.js:396
 
Remove a rigid body from the simulation.
body
 Body 
 
 removeEventListenertype
 listener
 Inherited from
 EventTarget:
 src/utils/EventTarget.js:50
 
Remove an event listener
type
 String
 
 listener
 Function
 
 The self object, for chainability.
stepdt
 [timeSinceLastCalled]
 [maxSubSteps=10]
 
 Defined in
 src/world/World.js:443
 
Step the physics world forward in time.
There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.
dt
 Number
 The fixed time step size to use.
[timeSinceLastCalled]
 Number
 optional
 The time elapsed since the function was last called.
[maxSubSteps=10]
 Number
 optional
 Maximum number of fixed steps to take per function call.
// fixed timestepping without interpolation
world.step(1/60);
 allowSleep
 Defined in
 src/world/World.js:39
 
Makes bodies go to sleep when they've been inactive
collisionMatrixPrevious
 Defined in
 src/world/World.js:130
 
CollisionMatrix from the previous step.
contactMaterialTable
 Defined in
 src/world/World.js:150
 
Used to look up a ContactMaterial given two instances of Material.
contacts
 Defined in
 src/world/World.js:46
 
All the current contacts (instances of ContactEquation) in the world.
defaultContactMaterial
 Defined in
 src/world/World.js:158
 
This contact material is used if no suitable contactmaterial is found for a contact.
dt
 Defined in
 src/world/World.js:33
 
Currently / last used timestep. Is set to -1 if not available. This value is updated before each internal step, which means that it is "fresh" inside event callbacks.
quatNormalizeFast
 Defined in
 src/world/World.js:61
 
Set to true to use fast quaternion normalization. It is often enough accurate to use. If bodies tend to explode, set to false.
quatNormalizeSkip
 Defined in
 src/world/World.js:54
 
How often to normalize quaternions. Set to 0 for every step, 1 for every second etc.. A larger value increases performance. If bodies tend to explode, set to a smaller value (zero to be sure nothing can go wrong).