Answers for "unity how to rotate an object around given angle"

C#
3

unity how to rotate something to point to something else

Vector3 dir = target.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(dir);
Vector3 rotation = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime * turnSpeed).eulerAngles;
partToRotate.rotation = Quaternion.Euler(0f, rotation.y, 0f);
Posted by: Guest on March-18-2020
2

how to rotation in something in unity

public Transform t;

transform.rotation = Quaternion.Eular(x,y,z);
Posted by: Guest on June-07-2021

Code answers related to "unity how to rotate an object around given angle"

C# Answers by Framework

Browse Popular Code Answers by Language