[fixed]Orge .skeleton animation loading bug and fix

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
sobieh
Posts: 54
Joined: Sat Feb 09, 2008 11:12 pm

[fixed]Orge .skeleton animation loading bug and fix

Post by sobieh »

I have read hybrid post saying Ogre animations are not supported due to some wrong data when reading keyframes so here we go:
First of all the Keyframe loader reads keyframe data in wrong order:
COgreMeshFileLoader::loadSkeleton


// Wrong order

readFloat(file, data, &keyframe.Time);
keyframe.Time+=animationTotal;
readVector(file, data, keyframe.Position);
readQuaternion(file, data, keyframe.Orientation);


// Correct order
readFloat(file, data, &keyframe.Time);
keyframe.Time+=animationTotal;
readQuaternion(file, data, keyframe.Orientation);
readVector(file, data, keyframe.Position);
Second bug is a wrong quaternion rotation transformation:
COgreMeshFileLoader::composeObject

// WRONG
rotkey->rotation = frame.Orientation + core::quaternion(keyjoint->LocalMatrix);

// CORRECT
rotkey->rotation = core::quaternion(keyjoint->LocalMatrix) * frame.Orientation;
With these fixes i can load .mesh and .skeleton files with no problems.

PS:
It would be also usefull to allow loading of .skeleton files separately.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Very nice catch. Already commited to 1.7 branch :D I've noticed some problems with the default models from Ogre SDK, also some other models from my own repository have many missing weights (don't know which serialization format they're from). So not yet full support for this format, but might be working already 8)
Post Reply