This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [SOLVED] [BUG] In the last anim, the model is rotated !  (Read 1183 times)

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
[SOLVED] [BUG] In the last anim, the model is rotated !
« on: June 07, 2015, 09:15:33 am »
Hi !

I have a model, and when I watch it with MDLVis, every animation works perfectly fine except the last one is turned 90° on its side.
Do you know what cause this and how to prevent/fix it ? Something must have it's coordinates flawed but I don't know what...

MDLVis : http://i.imgur.com/V17qaVk.png
Exported as MDL : https://gist.github.com/Koward/7d3bdbc6f0633c8981ab

EDIT : I think it could be some problems with the quaternions used for rotation. The problem is a rotation of -90° around Axis Y and a rotation of -90° around Axis X in the last animation.
Example : while a vertex is "normally' at (12,0,9), it becomes (9,12,0). I want it to stay like he is...
I don't have yet the math knowledge to understand what this means for the values in a quaternion.
I can learn it, but it will take time and if someone had an easy way that would be handy.
EDIT 2 : It seems I was wrong. Even when I put rotations to (0,0,0,0), there still is this little rotation. Damn, if I fix this bug my work will almost be done !

As I work on this while working on my LK>BC converter, I really wonder how a special animation can be affected and if the rotation handling changed between the two expansions.

EDIT Piaf : Solved, see my last post for information.
« Last Edit: June 13, 2015, 11:42:52 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: In the last anim, the model is rotated !
« Reply #1 on: June 09, 2015, 02:46:47 pm »
So, nobody could see a reason for this behaviour ? I'm struggling ><"
I guess I'm alone on this one then ;(
Maybe I should also try WC3 forums, this is their software after all, someone there may know what causes this.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

phucko1

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 523
    • View Profile
Re: [BUG] In the last anim, the model is rotated !
« Reply #2 on: June 09, 2015, 05:19:22 pm »
Well first; How did you convert the model to mdx?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [BUG] In the last anim, the model is rotated !
« Reply #3 on: June 09, 2015, 06:25:34 pm »
I converted the model from M2/LK to M2/BC with my own program and MDLVis is able to open these models directly. Then, I can save it as an MDX or MDL.

I know the fault is in my program. It's obvious. When MDLVIS reads the original models even the last animation is perfectly good.
 I'm just trying to find which component is failing (a bone, flags somewhere giving the orthonormal, 3D Witchcraft) and find a way to fix it.

Maybe I should try to convert the LK model to mdx using an other way, then compare the files to see what's wrong with mine ?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [SOLVED] [BUG] In the last anim, the model is rotated !
« Reply #4 on: June 10, 2015, 01:38:39 pm »
Okay, I solved my bug.

The quaternions in standard mathematics are (w, x, y, z) with w€R, x,y,z€C
In Blizzard models, they are (x, y, z, w). Since Warcraft 3. It should be mentioned on the Wiki. If it is, I have not seen it.
Sometimes I need to connect the last timestamp to the end timestamp, so I added one. By default, it's zeros.
It works perfectly with translations and scalings because they are 3D. (0,0,0) is fine.
Rotations are 4D and their rules are different. And the neutral is (-1, 32767, 32767, 32767), as they are 16 bits quaternions.
But this is a Blizzard model, so I have to add (32767, 32767, 32767, -1). F*cking fourth dimension.

More information about quaternions here : http://en.wikipedia.org/wiki/Quaternion
And an excellent book (which was fortunately in the library of my university, contains a lot of examples but mainly for physicists, I clearly did not understood everything x) ) : http://www.amazon.fr/exec/obidos/ASIN/0 ... rtinb06-21

That's the strangest issue I have ever solved myself.
At least now, my frog is perfect in MDLVis.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)