format
typescript
Quaternion.RotateTowards(from, to, max_delta_degrees)class: Quaternion
description
Rotates a quaternion from the current direction to the target direction.
parameter
| param_name | type | description |
|---|---|---|
| from | Quaternion | The starting direction. |
| to | Quaternion | The target direction. |
| max_delta_degrees | number | The maximum rotation angle. |
return
| type | description |
|---|---|
Quaternion | The rotated quaternion. |
code example
typescript
function QuaternionTest (){
// Starting quaternion direction
let a = new Quaternion(1,1,1,1);
// Target quaternion direction
let b = new Quaternion(2,1,2,1);
// Maximum rotation angle
let maxDeltaDegrees = 30;
// Create a quaternion that rotates from the starting direction to the target direction
let quaternion = Quaternion.RotateTowards(a, b, maxDeltaDegrees);
}