- Home /
Question by
lambolp1211 · Dec 19, 2018 at 05:03 AM ·
animationturning
How to play character turning animation when the camera rotates s certain degree like in fornite
Hi guys, i'm trying to make a third person controller like in fornite, it's pretty much done but i still can't figure out how to play character's underbody turning animation
Comment
Answer by Cornelis-de-Jager · Dec 19, 2018 at 05:12 AM
Get the angle between the camera and the players forward position
void Update()
{
var cam = Camera.Main.transform;
Vector3 targetDir = new Vector3 (0, cam.forward.y, 0);
float angle = Vector3.Angle(targetDir, transform.forward);
if (angle < 10.0f)
DoTheAnimationSequence();
}