Sign in to follow this  
tbcpp

Limiting a Quaternion/Matrix

Recommended Posts

Two questions about limiting quaternions. Question #1: I have a routine that can calculate a rotation matrix (and from there a Quaternion), so that I can make an object face another object. From this I can create a turret that will turn and face a target. However, this turret should not be able to turn as fast as it wants. How do I limit a matrix/quaternion so that it can only turn X deg/sec? Question #2: No turret can turn to any location on any axis. How do I limit the above matrix/quaternion so that it can only rotate on a single axis? Or even a part of an axis? As an example, picture a battleship. the turrets on the ship should be able to swing +90 to -90 from the front of the ship, and 0 to 45 in elevation, and do that rather slowly. This is the math I'm trying to figure out.

Share this post


Link to post
Share on other sites
If you are trying to implement fixed-axis objects like turrets, consider using local Euler angles. Their usual annoyances are exactly what you want in this instance, and adjusting the yaw and elevation separately is easy and realistic. You can just clamp the yaw and elevation values then.

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