I have recently begun making a space simulator game, and have had trouble making a character controller that can be used by both the AI and the player. My previous controllers stored the target angle in a quaternion where the ship would gradually turn towards it until the angles match (For players this value would be adjusted using Input.GetAxis).
Here is my code that works properly, but i have had trouble adapting it for the AI. How could I make it work while keeping the same turning speed? Any suggestions are welcome.
Quaternion.LookRotation is returning your "End-goal" rotation and then we're multiplying that by turn speed. On the other hand the player is giving 3 values between -1 & +1 which we multiply by turnspeed.
Off the top of my head, if you:
This will give you a Vector3 with all of it's values between -1 & +1 so you can muliply and use in transform.Rotate.
answered Jul 21 '12 at 06:21 PM