We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9557c4 commit b61142fCopy full SHA for b61142f
1 file changed
examples/jsm/animation/CCDIKSolver.js
@@ -204,7 +204,11 @@ class CCDIKSolver {
204
205
if ( c > 1.0 ) c = 1.0;
206
207
- const c2 = math.sqrt( 1 - c * c );
+ // preserve sign of the rotation along the limitation axis,
208
+ // otherwise negative rotations get mirrored to positive
209
+ const dot = link.quaternion.x * limitation.x + link.quaternion.y * limitation.y + link.quaternion.z * limitation.z;
210
+ const sign = dot < 0 ? - 1 : 1;
211
+ const c2 = sign * math.sqrt( 1 - c * c );
212
link.quaternion.set( limitation.x * c2,
213
limitation.y * c2,
214
limitation.z * c2,
0 commit comments