Physics:2D Physics Engine:Rotation

From GPWiki

Files:GUITutorial_warn.gif The Game Programming Wiki has moved! Files:GUITutorial_warn.gif

The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server.

However, the GPWiki forums are still active! Come say hello.

The following article is part of a series:

Files:GUITutorial_warn.gif This wiki page is under construction!

This page may be incomplete, missing information, or inaccurate!

Contents

Quick Vector Math Review

The cross product (the \times symbol representing the cross product) of two 2-dimensional vectors is:

\vec{a} \times \vec{b} = \vec{a}_x \vec{b}_y - \vec{a}_y \vec{b}_x

Applying a force at a point

To apply a force at a point, two equations are required: one for linear motion and one for rotation.

Linear Motion

Linear motion is rather simple. It it equal to the force applied:

  • \vec{F}_{linear}: The linear force that is to be applied to the object
  • \vec{F}: The force placed upon the object

\vec{F}_{linear} = \vec{F}

Rotational Motion

Rotation is slightly more complex, but just as easy to implement:

  • \vec{F}_{torque}: The torque that is to be applied to the object
  • \vec{F}: The force placed upon the object
  • \vec{p}: The point, relative to the center of gravity of the object, that the force is applied at

\vec{F}_{torque} = \vec{F} \times \vec{p}