Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How do I limit the angle of transform.lookat function

$
0
0
I have searched on google and the unity answers site and still haven't found a solution that works yet. I would like the head of my enemy character to only move -+90 degrees. So like a normal person. Now it just rotates 360 degrees and it is not natural. Is there any simple and safe way to do this. This is what I have already: public Transform head; //.... underneath is in an update function Vector3 playerPos = new Vector3(player.position.x, head.position.y, player.position.z); head.LookAt(playerPos); If anyone could help that would be great thank you

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>