Question by
XxFlyingCarrotxX · Jul 06, 2020 at 11:02 AM ·
mousethird-person-camera
Impose limit on LookAt for the characters head
I have added a sphere as a child of the camera. I put a script on my characters head to LookAt the sphere. I want to impose limits on the x axis so I don't snap his neck when doing a 360 view with my mouse. here is my very simple script to look at the sphere: public class HeadMovement : MonoBehaviour { public Transform target;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.LookAt(target);
}
}
Comment
Your answer
Follow this Question
Related Questions
how to make camera move with the mouse cursors 6 Answers
How to make my flashlight move with the mouse movement? 0 Answers
What is wrong with this simple code? 1 Answer
[C#]detect object on mouse look? 1 Answer
How can I create this particle effect 0 Answers