World stores and manages
Particle for 2D physics simulation
World for 2D physics simulation
a rectangular bounding box defined by a Group
a value between 0 to 1 where 1 means no friction. Default is 1
a number of a Pt to define gravitational force. Using a number is a shorthand to set
new Pt(0, n). Default is 0.
Get the number of bodies
Get the number of particles
Internal function to update bodies
Internal function to update particles
Get a body in this world by index or string id
numeric index of the body, or a string id that associates with it.
Draw bodies using the provided function
a function that draws bodies passed in the parameters
Draw particles using the provided function
a function that draws particles passed in the parameters
Get a particle in this world by index or string id
numeric index of the particle, or a string id that associates with it.
Remove either body or particle from this world. Support removing a range and negative index.
Either "body" or "particle"
Start index, which can be negative (where -1 is at index 0, -2 at index 1, etc)
Number of items to remove. Default is 1.
Update this world one time step
change in time in milliseconds
Static function to calculate edge constraints between 2 particles.
distance between particles
stiffness between 0 to 1.
use precise distance calculation. Default is
Generated using TypeDoc