# 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.

## 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 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.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 22
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002221
×