[ODE] physics question!
Martin C. Martin
martin at metahuman.org
Fri May 30 19:06:02 2003
Fig TaTam wrote:
>
> my physics skills are rather shaky, can you check if I calculate something
> correctly?
>
> I have a body that rotates about some point in space,
What point? The origin of the coordinate system? The body's own center
of mass? Or some other point? If it's another point, does this point
move over time, or is it fixed at some particular (x, y, z) world
coordinates?
> with gravity field present.
Is the gravity always in the same direction, like in most sims, or are you
simulating a solar system where (most) of the gravity field comes from the
central star? Is your body a planet that's rotating around a central star
that produces a gravity field?
> I know linear and angular velocity, and I know orientation of it in
> degree angles.
You mean Euler angles? Euler angles are generally very awkward for doing
calculations with.
> 2 forces act upon the body: gravity and centripetal force. I need to
> calculate 2 angles between the "true down" vector and "gravity+centripetal
> force" vector. 1 angle represents "pitch", the other is "roll". 3rd angle is
> irrelevant since it's possible to align 2 3D vectors using 2 angles.
True, although you'll lose the magnitude of the force.
> Centripetal force = mass * velocity^2 / radius
> angular_velocity = velocity/radius
> Centripetal force = mass * linear_velocity * angular_velocity
I'm a little rusty on my definition of centripetal vs. centrifugal force.
Is your body traveling in a circle? If so, that simplifies things
greatly. In that case, the centripetal force is always toward the center
of the circle.
> gravity vector is same as true down vector (0, 32.2*mass, 0). So Z-axis
> means forward/backward
>
> Since "mass" is same in both force vectors, I can cancel it out. Then to
> find 2 component angles between vectors, I need to:
>
> pitch_angle = arc tan( cent_force[X_AXIS] / 32.2 )
> roll_angle = arc tan( cent_force[Z_AXIS] / 32.2 )
>
> where pitch_angle lies in Y-Z plane and roll_angle lies in Y-X plane. Is
> this correct?
That doesn't seem quite right; if you made the centripetal force twice as
big, without changing its direction, your angles would change. Also, when
your centripetal force is straight down, your "roll" angle is undefined.
By the way, "roll" is a bit of a strange name for that. I think you want
yaw instead. One way to do it is to say your yaw angle is atan2(cent[X],
cent[Y]) and the cosine of your pitch is just cent[Z] / |cent|, where |v|
is the length of v.
- Martin