matthias-research / pages

My web page containing all the demos from my youtube channel "Ten Minute Physics" www.youtube.com/c/TenMinutePhysics
655 stars 136 forks source link

JointType FIXED implementation - Error in code? #4

Open SubtleMetaphor opened 3 years ago

SubtleMetaphor commented 3 years ago
if (this.type == JointType.FIXED) {
            let q = globalPose0.q;
            q.conjugate();
            q.multiplyQuaternions(globalPose1.q, q);
            let omega = new THREE.Vector3();
            omega.set(2.0 * q.x, 2.0 * q.y, 2.0 * q.z);
            if (omega.w < 0.0)
                omega.multiplyScalar(-1.0);
            applyBodyPairCorrection(body0, body1, omega, this.compliance, dt);                      
        }

line 322 in pages/challenges/PBD.js:

if (omega.w < 0.0)

omega is vector3, has no member w. Was q meant?

leoxupku commented 3 years ago

I think so, just using "q" to replace is resonable