Author Topic: Adding Rotations  (Read 21401 times)

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Adding Rotations
« Reply #30 on: February 17, 2007, 05:42:00 pm »
I hate to jinx it again, but it is working!!!!!!
Honestly! Its arms move out, the head turns left, the legs spread forwards:D

And the snake model moves in a robotic manner, just like blender!

I dont believe it!

Quaternions made this possible for me Egon.
Axis angle, the opposite matrices style(forgotten name:) column-...),
quaternions, and 5 days work!

It was a mixture of blender being cryptic, problems with post/pre multiply of matrices, gimbal lock, and ignoring multiple bone assignments(causing incorrect vertex warping)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Online EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Adding Rotations
« Reply #31 on: February 17, 2007, 05:51:27 pm »
Great! I'm glad that you've made it. The user of your API isn't confronted with the fact that matrices are column major internally or is he? Because that would be quite confusing...an API with row major matrices and an extension that uses column major.
BTW: I never understood why people are using column major at all. At least in germany, everyone does it the row major style in school and at universities. When reading a book or tutorial that uses column major this can be very confusing, because most of the time the writers don't mention which way they are using...and then you look at it and think: "What the **** are they doing there?", because everything looks just plain wrong... :wink:

Oh, and using matrices all the way doesn't lead to gimbal lock. Gimbal lock is caused by using euler angles. If you are using eulers internally and are creating matrices from them at each iteration, you'll run into it...if you are using matrices all the way, you won't. However, it's working now, so... :D

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Adding Rotations
« Reply #32 on: February 17, 2007, 05:58:36 pm »
great ;) i'm looking forward for a demo :D

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Adding Rotations
« Reply #33 on: February 17, 2007, 06:04:07 pm »
There is no problem with conflicts in the api;)
I am not that crazy;)

Actually, I believe the reason it works now, is mainly due to preMultiplication.

I was confused with bone axis inheritance, and this matrix implementation(from c++) allowed me to set a rotation, which could be applied to things after it has been applied.

I cant really understand it, so I cant explain it fully, but it works now, and it is almost definately because of this post/pre multiplication.

Btw, here is the source....
Its very simple api right now. I think it will be expanded on greatly, but it works, so Im very, very happy.

http://rpwar.com/cyber3/jpctSkeletalAPI.jar

That should work for your average ogre xml file.
I am testing uv right now, so I cant guarantee that working.
Im also adding a few lines to rotate the normals:) Just the same as vertex rotation, so it will be fine.

I would love someone to test it for me.

API:
http://rpwar.com/cyber3/doc/

Sample Models(x2)
http://rpwar.com/cyber3/models.zip
Note: these are weird animations:) Also, bare in mind I havent done normals yet.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Online EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Adding Rotations
« Reply #34 on: February 17, 2007, 06:10:24 pm »
Quote from: "cyberkilla"
Actually, I believe the reason it works now, is mainly due to preMultiplication.
Ah yes...i remember reading a tutorial done in column major manner (undocumented of course) and i was totally confused because every multiplication looked sooo wrong. It took me a few hours to realize that the problem was caused by column major vs. row major.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Adding Rotations
« Reply #35 on: February 17, 2007, 06:36:23 pm »
Complicated stuff, but well worth the experience. Im just glad I managed to finish it.

I think I will have uv and bone blending finished in a few hours.

EDIT:
I have done UV, and ive done normal inversion.

Ive tried bone blending, but it was a little more then adding vectors, like I thought it was, so I havent finished it yet.

Usage:
Code: [Select]

SkeletalObject3D[]  objects = loadOgreXML(java.io.InputStream in, java.io.InputStream skeletonIn, float newScale);

objects[0].advanceAnimation();

Thats it really;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Adding Rotations
« Reply #36 on: February 20, 2007, 07:30:45 pm »
Quote from: "cyberkilla"
Code: [Select]

SkeletalObject3D[]  objects = loadOgreXML(java.io.InputStream in, java.io.InputStream skeletonIn, float newScale);

objects[0].advanceAnimation();


seems as quite simple :) is it possible to specify how much the animation will be advanced ? how long the animation lasts ?

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Adding Rotations
« Reply #37 on: February 20, 2007, 11:24:17 pm »
That is specified in the files themselves.

I will add a scaling method though, so you can proportionately alter the timeframe of the animation.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG