seems that yr quaternion multiplication is wrong. i include the corrected formula
inline quaternion quaternion::operator*(const quaternion& other) const
{
quaternion tmp;
//wrong
//tmp.W = (other.W * W) - (other.X * X) - (other.Y * Y) - (other.Z * Z);
//tmp.X = (other.W * X) + (other.X * W) + (other.Y * Z) - (other.Z * Y);
//tmp.Y = (other.W * Y) + (other.Y * W) + (other.Z * X) - (other.X * Z);
//tmp.Z = (other.W * Z) + (other.Z * W) + (other.X * Y) - (other.Y * X);
//correct
tmp.W = (other.W * W) - (other.X * X) - (other.Y * Y) - (other.Z * Z);
tmp.X = (other.W * X) + (other.X * W) - (other.Y * Z) + (other.Z * Y);
tmp.Y = (other.W * Y) + (other.X * Z) + (other.Y * W) - (other.Z * X);
tmp.Z = (other.W * Z) - (other.X * Y) + (other.Y * X) + (other.Z * W);
return tmp;
}
same goes for yr matrix multiplication, the left matrix should use the row * column of the right matrix
if i want to do a matrix A *= B, it wont work
i have to do A = B*A;
quaternion and matrix multiplication is wrong
Re: quaternion and matrix multiplication is wrong
Sounds like you're confused by the row/column-major issue with the matrices? It's correct for doing the other way around, B *= A.