Model is rotated 90 degrees when animation applied

Software: Away3D 4.x

Mark Middleton, Newbie
Posted: 24 July 2012 05:44 AM   Total Posts: 8

I’m using Away3D 4.0 Gold, importing md5mesh and md5anims exported from Blender. I’m showing the bounding box on my model, and when I just add the model to the scene, it looks fine. But, as soon as I apply the animation, the model is rotated 90 degrees on the positive Y axis in away3d, but the bounding box stays in the original orientation of the model.

Has anyone else experienced something like this? Is there some way to update the bounding box? I’ve tried everything I can think of. All rotations, scale, and position is applied in Blender before exporting, and skeleton and mesh are at the origin. I’ve tried setting the bounding box of the mesh to a new AxisAlignedBoundingBox, that doesn’t seem to have any effect.

Would be very interested if anyone has any clues for how to approach this problem.

   

Richard Olsson, Administrator
Posted: 24 July 2012 07:53 AM   Total Posts: 1192   [ # 1 ]

That the bounding box is not updated when running animation is a known shortcoming that stems from the fact that re-calculating the bounds every frame would be too heavy. We do not have a good solution for this in place yet, but are thinking about a number of different alternatives.

The rotation issue sounds like a bug that was fixed a while ago. Are you 100% sure that you’re using the gold release (e.g. from here on the website, or from the master branch of GitHub)?

The bug report is here:
https://github.com/away3d/away3d-core-fp11/issues/238

   

Mark Middleton, Newbie
Posted: 24 July 2012 04:28 PM   Total Posts: 8   [ # 2 ]

Thanks for the fast reply. I just double-checked, and I’m sure I’m using the gold release. I looked at what was changed on that bug report, and what I’m using matches the code that was changed in the MD5Anim parser. When that bug was fixed, this line:

t2.fromAxisAngle(Vector3D.Y_AXISMath.PI*.5); 

was changed to:

t2.fromAxisAngle(Vector3D.Y_AXIS, -Math.PI*.5); 

I tried changing it back, and now the model was rotated 90 degrees on Y in the opposite direction. So, changing the line to this fixes it for me:

t2.fromAxisAngle(Vector3D.Y_AXIS0); 

I’m not sure if this is how it should be in Away3D, or if this is correcting something that’s wrong with my skeleton or animation. Let me know if you want me to send you my md5 files to demonstrate. Thank you!

   

Avatar
Matse, Sr. Member
Posted: 24 July 2012 04:55 PM   Total Posts: 149   [ # 3 ]

This could be a problem with your animation : I’m no graphic artist, but at some point in our game project we had a monster that would play attack animation correctly, then rotate 90° when playing a “hit” animation.
It depends on the root bone orientation in each animation file, it should be the same for every animation.

   

Avatar
David Lenaerts, Administrator
Posted: 24 July 2012 05:03 PM   Total Posts: 80   [ # 4 ]

There seems to be some discrepancies between exporters. Whereas Blender’s exports seem more “correct”, the id Software exports seem to need the additional rotation aroudn the Y-axis (we’re using that as a default; it’s their format after all!).

The MD5MeshParser and MD5AnimationParser have that sorted though. You can pass in an additional rotation to apply; just create a parser object for the animation like so:
var parser : MD5AnimationParser = new MD5AnimationParser(Vector3D.Y_AXIS, Math.PI*.5);

... and pass it into the load/parse call of your animation.

Hope that helps!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X