diff options
| author | raysan5 <raysan5@gmail.com> | 2017-07-23 17:29:51 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2017-07-23 17:29:51 +0200 |
| commit | b2712b6db7c184aff47436f387f2012cf77f4f67 (patch) | |
| tree | 7fbb2c5b682a9c1fc7e2a0de30d60747129beb9c /src | |
| parent | f57367e786089e9bb53f0b245f15e989822fcdb1 (diff) | |
| download | raylib-b2712b6db7c184aff47436f387f2012cf77f4f67.tar.gz raylib-b2712b6db7c184aff47436f387f2012cf77f4f67.zip | |
Corrected issue on QuaternionFromVector3ToVector3()
Diffstat (limited to 'src')
| -rw-r--r-- | src/raymath.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/raymath.h b/src/raymath.h index 855f97b0..cd45c0b5 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -1126,13 +1126,15 @@ RMDEF Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to) q.x = cross.x; q.y = cross.y; q.z = cross.y; - q.w = 1.0f + cos2Theta; - - QuaternionNormalize(&q); + q.w = 1.0f + cos2Theta; // NOTE: Added QuaternioIdentity() + + // Normalize to essentially nlerp the original and identity to 0.5 + QuaternionNormalize(&q); - Quaternion result = QuaternionNlerp(q, QuaternionIdentity(), 0.5f); + // Above lines are equivalent to: + //Quaternion result = QuaternionNlerp(q, QuaternionIdentity(), 0.5f); - return result; + return q; } // Returns a quaternion for a given rotation matrix |
