Jump to content
  • Advertisement
Sign in to follow this  
tbcpp

Limiting a Quaternion/Matrix

This topic is 3417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!