> Now, I've got translational movement working pretty perfect, but I
> just cannot seem to figure out angular movement.
If you have a rectangle (or any other shape for that mapper) and you know
its center of mass and its moment of inertia, then it is simple.
Center of mass and moment of inertia are simple to calculate and I am sure
you can find many descriptions of those. For example
http://hyperphysics.phy-astr.gsu.edu/hbase/mi.html
The only "tricky" thing about totation and translation in 2D is that if
you
pull at a point which is offset from your center of mass, then you get
roation and translation, and the translation is exactly the same as if you
puled at the center of mass. That confused me somewhat when I wanted to
learn this.
Rotation is as translation. You have torque (as force) and you have moment
of inertia (as mass) and you have angular acceleration and angular
velocity
(as acceleration and velocity).
Imagine a rectangle in a coordinatesystem, so it is axis aligned and 10
meter wide (along x) and 5 meter tall (along y). Center of mass is at 0,0
and we define the mass to be 100kg and the moment of inertia to be 100Nm
You pull at one end at (10,0) with a force of 100N
The length of the linear acceleration is then 100kg/100N=1m/s^2 and the
direction is along the y-axis. The accleration vector is (0,1m/s^2)
The angular acceleration is (100N*10m)/100Nm=10rad/s
When you simulate this with some time step, you update the
position,velocity,rotation and angular velocity by those values and so on.
This was written in all haste and may be unclear, but you did write ASAP
;-)
I actually have an old example of a 2D space****p with a few thrusters
which
is doing this. Let me know if you are interested.


|