Creates a rotation which rotates from fromDirection
to toDirection
.
toDirection
in world space.// Sets the rotation so that the transform's y-axis goes along the z-axis transform.rotation = Quaternion.FromToRotation (Vector3.up, transform.forward);
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Example() { transform.rotation = Quaternion.FromToRotation(Vector3.up, transform.forward); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Example() as void: transform.rotation = Quaternion.FromToRotation(Vector3.up, transform.forward)