This project allows you to look at the simulation of softbody, and nothing more
- -
constructor(x: number, y: number)
- Create new Point object with coordinates - (x, y).
- -
constructor(points: Point[], elsticity: number = 0)
- Create new Collision object from points.
- -
constructor([x: number, y: number], mass: number, radius: number)
- Create new Particle object with coordinates - (x, y), mass - "mass" and radius - "radius".
- -
constructor(particles: Particle[], connects: {a: number, b: number}[], stiffness: number)
- Create new Softbody object consisting of connected particles. The "connections" array shows which particles are connected to each other. Stiffness shows how strong the bond between the particles is.
- -
useSoftbody(softbody: Softbody, collisions: Collision[])
- Hook that returning [particlesCoordinate, springsCoordinate] and updating softbody position each frame.
- -
<ParticleComponent particle: {x: number, y: number, r: number} height: number/>
- Drawing Particle on canvas. Set particle from field particleComponents of softbody hook. Set height of canvas in height. - -
<SpringComponent spring: {a: Point, b: Point} height: number/>
- Drawing connection in softbody on canvas. Set spring from springsComponents of softbody hook. Set height of canvas in height. - -
<SpringComponent collision: Collision height: number/>
- Drawing collision on canvas. Set collision from object. Set height of canvas in height.
Project skubivi.softbody is distributed under the MIT license.