Legacy Documentation: Version 2017.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Transform.localRotation

Switch to Manual
public var localRotation: Quaternion;

Description

The rotation of the transform relative to the parent transform's rotation.

Unity stores rotations as Quaternions internally. To rotate an object, use Transform.Rotate. Use Transform.localEulerAngles for modifying the rotation as euler angles.

    // Set the rotation to be the same as the parent
    transform.localRotation = Quaternion.identity;

Did you find this page useful? Please give it a rating: