Sign in to follow this  
bzroom

Clamping relative angular velocity, using Euler decomposition.

Recommended Posts

I'm working on a 3 axis rotation constraint between two rigidbodies.

---Long question, scroll down for short question---
The artist is able to specify the constraint limits in Euler Coordinates, in any Euler combination order (via their animation package).
I use CML to decompose and compose quaternions from Euler angles.

To correct the angular position error of the two bodies, i first compute the current relative angle at the constraint point, decompose to euler angles, clamp, and recompose into a delta which i use to correct the two bodies orientations.

In order for this to be a stable relaxation method their angular velocities must be kept in sync with their position updates.
To keep the ball rolling, i simple set both of their angular velocities to the average. This essentially tries to preserve a zero relative angular velocity.

Now i'm trying to free up the angular velocity so i want to clamp it piecewise, in the same Euler coordinates that the artist uses.
This is where i get a little caught up.

The angular velocities are stored as vectors in world space, where each vector component is the angular velocity about the fixed world axes.
I'm not sure if the relative angular velocity between two bodies is merely, wB - wA?

Also, if i want to deal with the angular velocity in the constraint's anchor's space, can i simply transform W into local coordinates and back again after clamping?

So here's what i tried that didn't exactly work:

1.) convert world W to constraint local W.
2.) compute relative W at constraint (subtraction)
3.) treat angular vector as an axis angle and build a quaternion
4.) decompose quaternion to euler angles, clamp and recompose.
5.) convert quaternion back to angular vector
6.) use this new clamped relative velocity vector to update the local body angular velocities
7.) convert back to world space.

I think 3, 4 and 5 are highly questionable.

When i do the orientation clamping i store off whether each limit has been reached (-x,+x, -y, +y,-z, +z) and i use these to clamp the angular velocities in euler coordinates.

--- Short Question: --
How do i convert an angular velocity vector into the same Euler coordinates i used to clamp the orientation?

Share this post


Link to post
Share on other sites
I think the quick solution for me is going to be taking the world orientation delta from the orientation clamp that happened in constraint space, and using that to compute a world torque.
Seems a lot easier and faster than all that BS. :)

But if someone could still answer this:
Say you wanted to apply angular damping in local space, control damping about your local yaw axis.
How would one convert the world angular velocity into local coordinates, damp, and then convert back?

I've tried just using the body's world transformation matrix, but the results were wonky and looking into the math it seems they were not correct.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this