format
typescript
Quaternion.FromToRotation(from_dir, to_dir)class: Quaternion
description
Creates a quaternion that rotates from the direction specified by from_dir to the direction specified by to_dir.
Typically, you use this method to rotate a transform so that one of its axes (e.g., the Y-axis) aligns with a target direction in world space.
parameter
| param_name | type | description |
|---|---|---|
| from_dir | Quaternion | The quaternion representing the initial direction. |
| to_dir | Quaternion | The quaternion representing the target direction. |
return
| type | description |
|---|---|
Quaternion | The new quaternion. |
code example
typescript
function QuaternionTest (){
let identity = Quaternion.identity;
let quat_axis = Quaternion.AngleAxis(60, new Vector3(0,1,0));
let from = Quaternion.FromToRotation(identity, quat_axis);
}