What I have done the last days:

– contact point calculations

– two collision response models (simple & fast + physical accurate)

– different integrators (Euler, Verlet, Mid-Point, RK4)

– basic forces (gravity, spring, attractor, repulsor..)

– dynamic and static friction

So basically the engine is working now. There are some small bugs when handling multiple simultaneous contacts which I’ll solve later. Now it’s time to build a framework, optimize and clean-up the code and convert it to AS3.

I’ll post some new demos the next day, but here is a small preview: Scene A, Scene B

Great work. any chance you can release code so some of us less physics savvy people can follow along?

Since I put a lot of work into my engine I will not publish the source code but I will perhaps release the API so anybode can use it by including a compiled swf.

wow, that’s impressive. could you breifly explain the difference between the collision response models? ..i’m guessing this is all impulse-based, and i only know of one way to handle normal and tangent/friction impulses.

also, AFAIK your method for finding the moment of inertia for convex polygons works with concave polygons too: triangles with negative signed areas have their moments “subtracted” from the total.

of course, the hard part is triangulating ;)

you are right, it should work with convex polygons, too. I didn’t realized it, because my engine only supports convex polygons anyway.

the cheap collision model does only a simple vector reflection about the normal of collision, so the new reflected velocity is v – (2 * (v.n)) * n. It computes the linear momemtum p of the center of mass only (p = mass times velocity). The linear momentums derivative is force: F = dp/dt = d(m*v)/dt = ma.

the advanced method supplies angular effects by taking into account where the object was hit and computes the angular momentum, too. The derivative of angular momentum is torque.

Adding force and torque together and integrating over time finally gives velocity and position.

are you using a force-based or velocity/impulse-based approach?

actually both, because you can’t really seperate impulses and forces.

I am calculating impulses from forces, after all forces acting on the body have been summed up. (forces are integrated to get impulses). when a collision occurs, an impulse is applied directly to the body to change their velocities instantly.

do you mean the standard “integrate the bodies forward in time (which does involve summing and integrating forces), then resolve collisions using impulses”? or is there something special going on with how you treat the forces?

i guess i meant penalty-methods or impulses.. i’m asking because things seem very stable/un-jittery for an impulse-based simulator, but very solid for penalty-methods.

ah now I know what you mean. I use standard impulses as you said first. However they are averaged and applied until the bodies become stable. Its hard to explain right know because I am experimenting with a mix of different approaches and still have to figure out the best way. e.g. if I increase the timestep or/and use objects with large variations in masses the jittering becomes more apparent.

cool — i was wondering about how you were using impulses, because i haven’t gotten them to behave as nicely as in your demos. but i’ll wait till it’s done “cooking” to find out ;)

Awesome stuff. Am working on similar things in java.