Browse Source

interval: fix QuatInterval not normalizing the start quaternion

rdb 6 years ago
parent
commit
b75982a610

+ 4 - 0
direct/src/interval/cLerpNodePathInterval.I

@@ -106,6 +106,8 @@ set_end_hpr(const LQuaternion &quat) {
  * if either set_end_quat() or set_end_hpr() is also called.  This parameter
  * is optional; if unspecified, the value will be taken from the node's actual
  * rotation at the time the lerp is performed.
+ *
+ * The given quaternion needs to be normalized.
  */
 INLINE void CLerpNodePathInterval::
 set_start_quat(const LQuaternion &quat) {
@@ -143,6 +145,8 @@ set_end_quat(const LVecBase3 &hpr) {
  * This replaces a previous call to set_end_hpr().  If neither set_end_quat()
  * nor set_end_hpr() is called, the node's rotation will not be affected by
  * the lerp.
+ *
+ * The given quaternion needs to be normalized.
  */
 INLINE void CLerpNodePathInterval::
 set_end_quat(const LQuaternion &quat) {

+ 2 - 2
direct/src/interval/cLerpNodePathInterval.cxx

@@ -174,14 +174,14 @@ priv_step(double t) {
           setup_slerp();
 
         } else if ((_flags & F_bake_in_start) != 0) {
-          set_start_quat(transform->get_quat());
+          set_start_quat(transform->get_norm_quat());
           setup_slerp();
 
         } else {
           if (_prev_d == 1.0) {
             _start_quat = _end_quat;
           } else {
-            LQuaternion prev_value = transform->get_quat();
+            LQuaternion prev_value = transform->get_norm_quat();
             _start_quat = (prev_value - _prev_d * _end_quat) / (1.0 - _prev_d);
           }
           setup_slerp();

+ 1 - 0
doc/ReleaseNotes

@@ -14,6 +14,7 @@ This is a bugfix release intended to fix several issues in 1.10.0.
 * Depth buffer now defaults to 24-bit on macOS (fixes flickering)
 * Fix no devices being detected on Windows with threading-model
 * Implement collision tests from Capsule and Box into InvSphere
+* Fix odd behavior and occasional crash in QuatInterval
 * Fix SpriteAnim error in particle system
 * Fix ShaderGenerator error when using too many shadowing lights
 * Fix interrogate crash in Python 3 with optional wstring args