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.
-> 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);


-> 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