A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by DIMOSUS.X » Mon Oct 04, 2010 12:28 pm
Greetings, could you please help me?
There is a physical agent, being placed into free space and having an angular damping not equal to zero. A constant rotational moment is applied to the agent. As a result, the agent is rotating with some constant speed.
I need to find an angle of the agent’s rotation under inertia exposure, after the rotational moment is gone.
How can I compute it?
-
DIMOSUS.X
-
- Posts: 2
- Joined: Mon Oct 04, 2010 12:26 pm
by Julio Jerez » Mon Oct 04, 2010 1:32 pm
you can just get the quaternion rotation before and after the step and extract the angule for the instant rotaion around the body angular velocity vector
you can get the angle using this function adapted from the dMatrix class in the SDK
- Code: Select all
dFloat dQuaternion::CalcAverageAngle (const dQuaternion &QB) const
{
dFloat dirMag;
dFloat dirMag2;
dFloat omegaMag;
dFloat dirMagInv;
dQuaternion dq (Inverse() * QB);
dVector omegaDir (dq.m_q1, dq.m_q2, dq.m_q3);
dirMag2 = omegaDir % omegaDir;
if (dirMag2 < dFloat(dFloat (1.0e-5f) * dFloat (1.0e-5f))) {
return dVector (dFloat(0.0f), dFloat(0.0f), dFloat(0.0f), dFloat(0.0f));
}
dirMagInv = dFloat (1.0f) / dSqrt (dirMag2);
dirMag = dirMag2 * dirMagInv;
omegaMag = dFloat(2.0f) * dAtan2 (dirMag, dq.m_q0) / dt;
return dirMagInv * omegaMag;
}
Quertion r0 = BoadyGetRoation();
UpdateBody
Quertion r1 = BoadyGetRoation();
angle = r0.CalcAverageAngle (r1);
this will guve you the angle the body rotated around the axis of rotation given by normalizing its angular velocity vector.
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by DIMOSUS.X » Mon Oct 04, 2010 2:55 pm
This angle must be predicted before the body stops. Is there any way to do it?
And, if possible, we need to know how long body will rotate by inertia after applying force.
-
DIMOSUS.X
-
- Posts: 2
- Joined: Mon Oct 04, 2010 12:26 pm
by Julio Jerez » Mon Oct 04, 2010 3:10 pm
that will be hard, you can crate and extra world with a copy of the body and advance for few frames
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by stnal » Wed Nov 10, 2010 4:46 am
Good idea to have a copy of the world, how expensive is it? Do I need to copy all object in world as well?
I can see it is useful for physics projection in the client of a multiplayer game.
-
stnal
-
by JernejL » Wed Nov 10, 2010 11:48 am
It should not be very prohibitive, i think some shapes can be actually reused across separate newton worlds.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 45 guests