Answers for "how to lock an axis in unity"

C#
0

how to lock an axis in unity

float lockPos = 0;
void Update()
{
     transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, lockPos, lockPos);
}
//Whatever you set the "lockPos" to, is what the axes will lock at.
//And wherever you feed back its own rotation (transform.rotation.eulerAngles.x, for instance), is a "free angle", and will not be locked.
Posted by: Guest on October-02-2021

Code answers related to "how to lock an axis in unity"

C# Answers by Framework

Browse Popular Code Answers by Language