- Home /
Rotation limits
I'm making a sort of hovercraft in my game and of course want it to folow the contore of the ground it is going over. right now its just a stretched out ball using a clear capsule collider to drive it. i'd like to get it to the point where it will rock forward and back but not flip end over end. all of the examples i can find restrict rotation acording to time but i need something that limits it acording to position.
i'm using the Rigidbody constraints to keep it from moving side to side.
Answer by StephanK · Feb 11, 2011 at 08:57 AM
To follow the ground you will have to detect the normals from the piece of ground you are over and adjust your rotation accordingly. You can do this by using a raycast in the "down" (-transform.up) direction of your vehicle. To adjust your rotation look at the Quaternion.SetLookRotation function.
Your answer
Follow this Question
Related Questions
Transform.rotate limits 3 Answers
Camera Limit Rotations Problem 1 Answer
simple plane code how to limit rotation 2 Answers
Limit distance from center 0 Answers
Restricting Rotation 2 Answers