2D rigid body physics engine
Uploader Comments (Draknek)
All Comments (16)
-
WOW how did you do this? can you tell me some algorithms?
-
can i see source code?
this is awsome
-
I was thinking of attending your project presentation but I couldn't work out when / where it was and if we were allowed to or not :(
When i finish my exams next week I'll be having a proper look at all this, I could do with finally getting my head round what 'torque' actually is for a start, haha.
Jon.
-
hehe, unfortunately I missed the last couple of graphics lectures because I was revising / finishing my 3rd year project. I just had the graphics exam today in fact, didn't go down well with most people with the general consensus being there was way too much content, lol.
I saw your physics engine project on the fourth year projects web page while we were trying to decide on our own fourth year project for next year.
how much calculus did you know when you made this?
Im Doing a similar project and the papers im reading say that calculus is required.I just want to be able to rotate shapes like you have done here. I know how to rotate i just dont know how to get the angular velocity/speed.
Honestly, it took me ages to teach myself how SAT collision works and now this... its a sad day for me.
thecoast47 6 months ago
@thecoast47 I knew calculus but would not consider it important. What you want is algebra plus physical laws: given linear and angular velocities before collision (known variables), find velocities after (unknown variables). Constraints: collisions should conserve both momentum and angular momentum.
Conservation of angular moment involves something called the moment of inertia. I'd recommend the book Game Physics Engine Development by Ian Millington to someone at your level.
Draknek 6 months ago
significant effect on the object's rotation if the low-density protruding edge hit a static object like a very dense object. Would the object spin around its centre of gravity or would it continue to follow the path the centre of gravity was taking while the low-density part simply span around it... Confusing for me anyway... :p
Right - back to work hehe.
JonnyCasey 2 years ago
Heh, small world. If you did the Graphics module, you would have seen me give a presentation about my fourth year physics engine project.
You resolve a collision like that by splitting the force into a linear component and an angular component and applying them separately. In your example, the moment of inertia would be low and the torque small, so most of the impact would go into rotation (but some small amount would go against linear velocity).
Draknek 2 years ago
Every Body has 2 Forces, Directional and Rotational.
How do you compute these force after collision to obtain the reaction?
reexre 2 years ago
In brief:
1) I calculate the combined change of linear and angular velocity caused by a unit impulse at the contact point.
2) I reverse this result to get the impulse required to produce a given change of velocity.
3) I calculate the change of velocity required for separation (using coefficient of restitution).
4) I combine these to get the size of the impulse.
(Impulse = instantaneous force)
For more information, I recommend the book Game Physics Engine Development by Ian Millington.
Draknek 2 years ago