Sonntag, 12. April 2020

Unity - avoid physical rotation of a rigid body - object should remain parallel to the horizont

Prefer to set the checkmarks in the RigidBody Settings at.
Constraints
-> Freeze Rotation Z

Otherwise by code simply reset any calculated rotation to 0 in each frame within the Update function:

float lockRotation = 0f;
gameObject.transform.rotation = Quaternion.Euler(lockRotation, lockRotation, lockRotation);

TIP:


            
Constraints
-> Freeze Position X 
will prevent the character from sliding down physically from a slant platform.

0 Kommentare:

Kommentar veröffentlichen

Abonnieren Kommentare zum Post [Atom]

<< Startseite