AvatarController.RotateToInitialPosition C# (CSharp) Method

RotateToInitialPosition() public method

public RotateToInitialPosition ( ) : void
return void
    public void RotateToInitialPosition()
    {
        if(bones == null)
            return;

        if(offsetNode != null)
        {
            // Set the offset's rotation to 0.
            offsetNode.transform.rotation = Quaternion.Euler(Vector3.zero);
        }

        // For each bone that was defined, reset to initial position.
        for (int i = 0; i < bones.Length; i++)
        {
            if (bones[i] != null)
            {
                bones[i].rotation = initialRotations[i];
            }
        }

        if(Root != null && Root.parent != null)
        {
            Root.parent.localPosition = Vector3.zero;
        }

        if(offsetNode != null)
        {
            // Restore the offset's rotation
            offsetNode.transform.rotation = originalRotation;
        }
    }