Code: Select all
axis = axis.crossProduct(core::vector3df(X,Y,Z));
if (axis.getLength()==0)
{
axis.set(0.f,1.f,0.f);
axis.crossProduct(core::vector3df(X,Y,Z));
}
This cannot be right.
After a little google search, I found the very same code(even with the same commentaries) in the Ogre repository, where it is part of the Vector3 class, which makes sense, because then the starting vector's components are used. So i propose the following fix:
Code: Select all
axis = axis.crossProduct(v0);
if (axis.getLength()==0)
{
axis.set(0.f,1.f,0.f);
axis.crossProduct(v0);
}
Agent D