Quantcast
Channel: Answers by "Hachley"
Viewing all articles
Browse latest Browse all 36

Answer by Hachley

$
0
0
I have something an old project of mine, where the enemy was facing the player and later chased him. Here's what I used for the enemy to smoothly turn at the target and face him: var target : Transform; var damp = 6.0; function lookAtTarget() { var rotation = Quaternion.LookRotation(target.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damp); //turn smoothly } It's JS though. Hope it helps.

Viewing all articles
Browse latest Browse all 36

Trending Articles



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