I'm trying to adapt a ported version of the FLADE flash verlet physics engine into Blitzmax to fit my needs, and so far it's been pretty good, but now I'm kind of stuck. One of the things I'm trying to change is to include velocity in the engine, instead of having particles store their current and previous velocities and figure the velocity from that. The biggest problem with including velocity is how to resolve constraints. With the current and previous velocities, it is relatively easy, but adding velocity complicates things.
p1 = first particle constrained
p2 = second particle constrained
curr = current position (vector)
I tried to simply replace the last two lines with
But when i ran a test, the particles joined by constraints get all jiggly and get messed up when a collision occurs.
Can verlet constraints be achieved with velocity?
Method resolve() Local delta:Vector = p1.curr.minusNew(p2.curr) Local deltaLength# = p1.curr.distance(p2.curr) Local diff# = (deltaLength - restLength) / deltaLength Local dmd:Vector = delta.mult(diff * stiffness) p1.curr.minus(dmd) p2.curr.plus(dmd) End Method
p1 = first particle constrained
p2 = second particle constrained
curr = current position (vector)
I tried to simply replace the last two lines with
p1.vel.minus(dmd)
p2.vel.plus(dmd)
But when i ran a test, the particles joined by constraints get all jiggly and get messed up when a collision occurs.
Can verlet constraints be achieved with velocity?