Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

2D rigid body physics engine

Loading...

Sign in or sign up now!
3,633
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 17, 2008

NOTE: see my more recent project:
http://www.youtube.com/watch?v=IzuShHTcp4U

This is the state (as of Feb 08) of my third year Computer Science project written in C++.

I've finally gotten rid of most of the jitter that I've been experiencing since adding rotation, so I am happy.

Category:

People & Blogs

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (Draknek)

  • 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 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.

  • 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.

  • 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).

  • Every Body has 2 Forces, Directional and Rotational.

    How do you compute these force after collision to obtain the reaction?

  • 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.

see all

All Comments (16)

Sign In or Sign Up now to post a comment!
  • 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.

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more