void VPathNode::updateWorldData( void ) { if ( !mPath ) { setWorldPosition( getLocalPosition() ); setWorldRotation( getLocalRotation() ); return; } // Fetch Path Details. const MatrixF &pathTransform = mPath->getTransform(); const QuatF &pathRotation( pathTransform ); // Calculate the World Position. Point3F newPosition = getLocalPosition(); newPosition.convolve( mPath->getScale() ); pathTransform.mulP( newPosition ); // Calculate the new Rotation. QuatF newRotation; newRotation.mul( getLocalRotation(), pathRotation ); // Apply. setWorldPosition( newPosition ); setWorldRotation( newRotation ); }
Point3F & QuatF::mulP(const Point3F& p, Point3F* r) { QuatF qq; QuatF qi = *this; QuatF qv( p.x, p.y, p.z, 0.0f); qi.inverse(); qq.mul(qi, qv); qv.mul(qq, *this); r->set(qv.x, qv.y, qv.z); return *r; }