Answers for "smooth looking in unity"

C#
0

smooth looking in unity

Transform target; //whatever you want the object to look at
float turningRate = 2f;
turningRate /= 100;

Transform looker = null;

//create a empty gameObject on the object that you are rotating
foreach(Transform child in transform)
{
	if(child.name == "Child of Transform")
    {
    	looker = child;
    }
}

looker.LookAt(targetPlayer);

transform.localRotation = Quaternion.Slerp(transform.rotation, looker.rotation, turningRate * Time.deltaTime);
Posted by: Guest on April-27-2021

C# Answers by Framework

Browse Popular Code Answers by Language