[fixed]quaternion::rotationFromTo() wrong

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
takamoto
Posts: 1
Joined: Mon Oct 07, 2013 1:11 pm

[fixed]quaternion::rotationFromTo() wrong

Post by takamoto »

Isn't this wrong?

Code: Select all

 
    else if (d <= -1.0f) // exactly opposite
    {
        core::vector3df axis(1.0f, 0.f, 0.f);
        axis = axis.crossProduct(v0);
        if (axis.getLength()==0)
        {
            axis.set(0.f,1.f,0.f);
            // axis.crossProduct(v0); // wrong
            axis = axis.crossProduct(v0); // correct
        }
        // same as fromAngleAxis(core::PI, axis).normalize();
        return set(axis.X, axis.Y, axis.Z, 0).normalize();
    }
 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: quaternion::rotationFromTo() wrong

Post by CuteAlien »

Thanks, calling crossProduct without using the result does indeed not make sense. It's fixed now in svn release branch 1.8 in revision 4583. Will be merged with trunk soon.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply