Jump to content
Sign in to follow this  

inverse matrix for crowd agents orientation quaternion

Recommended Posts

I'm working on a simulation that has some crowd agents following a terrain using its normals as the up vector (for simplicity we can assume the terrain is a sphere).  I've got my base simulation setup working fine, but in one case the sphere is moving really fast through the scene in world space.  On certain frames where the terrain is moving extremely fast the crowd agents basically can't calculate the next frame so there positions end up being 'Nan' or undefined and they disappear.

I tried running the simulation with up to 50 substeps, and that improves how many agents survive to the end of the simulation a bit, but still about half of them are still lost by the end of the sim.

in order to combat this i managed to create a point vop that creates a transformation matrix from a tracked maya rivet/locator on the sphere.  Then I applied the inverse matrix transformation to freeze the sphere at the origin to run the simulation.

After the simulation is done, I'm able to re-apply the transformation matrix to the sphere to get it back to the correct spot.

However, when I try to apply the matrix to the crowd agents, their final positions look correct, but their orientations are wrong.  I believe the orientation attribute is the quaternion for all the agents rotations?  Any ideas on how I would go about getting the agents to re-align correctly again after the simulation has been run?

baking down the agents geometry and then applying the transformations seems to work, but this approach is really slow because of the amount of geometry it has to process, makes it quite difficult to iterate.

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