Adding Rotations

Started by cyberkilla, February 16, 2007, 02:19:28 PM

Previous topic - Next topic

cyberkilla

So I have to rotate everything?

If everything is using a different coordinate system, then
shouldnt it work fine, but the whole model will be upside down?

Apologies for my ignorance:)

EDIT:
Also, given that the coordinate system is affected in object space,
why is it that only the keyframes are wrong, yet the mesh, and the rest pose of the bones work? I think I'm at the very pinnacle of confusion now :wink:
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

raft

there is one more point to consider: Object3D.rotateX,Y,Z methods behave differently. rotateX and rotateZ rotates object counter-clockwise while rotateY rotates clockwise

egon you will remember, i once discovered this and you said you didnt noticed it before. it was also strange to discover that 3d max does the same too. so it may be some sort of standard

this may be relevant to the case
r a f t

cyberkilla

Interesting:)

Yeh, I do not believe it would affect the model in the way it seems to be.

Even without applying any object3D rotations, it does the same trick.
I wonder if its a blender export issue.
I think id be wise to try someone elses model.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Quote from: "raft"egon you will remember, i once discovered this and you said you didnt noticed it before. it was also strange to discover that 3d max does the same too. so it may be some sort of standard
Yes. I've recently (re-)discovered the corresponding parts in the Javadocs and thought by myself what causes this and if it's really a correct behaviour. I came to the conclusion that it's caused by the way the rotations matrices are build. I'm not doing anything special there, so i doesn't make me wonder that 3ds shows the same effect...but it eases me off... :wink:

cyberkilla

Still nothing.

It is most strange how only keyframes are being affected.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Fixed it!
It was blender :shock:  :?  :roll: !

Its still a bit wrong, but it moves pretty well now.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen


cyberkilla

I cannot explain very well.

Apparently, some of the scaling, and translations were done in world space, when they were supposed to be done in object space.

To fix it, you must enter Object Mode, select the object(skeleton), and press CTRL+A.

This makes all translations and scales local(object space).

Apparently it is a bit source of confusion for people.
I was convinced id only used object space, but, reality begs to differ.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Quote from: "raft"there is one more point to consider: Object3D.rotateX,Y,Z methods behave differently. rotateX and rotateZ rotates object counter-clockwise while rotateY rotates clockwise

egon you will remember, i once discovered this and you said you didnt noticed it before. it was also strange to discover that 3d max does the same too. so it may be some sort of standard

this may be relevant to the case
r a f t

Wait, this is affecting it! It must be! Only the Y axis is inverted now!
Thanks raft;) No idea how ill "hack" it into an inverted axis.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

It seems to work better now. Granted, it isnt an identical copy of the Blender version, but it is pretty good.

Edit:

Nope, still broken :roll:

Egon, is your implementation of matrices standard? I know the loader
im basing this all from uses a different matrix format to you, as you said.

I just wonder if there is something in the matMul that is different in jPCT to c++.

I really want this fixed. I have so much to finish on my FutureRP project.
The annoying thing is that the hardest, most perplexing problem, is the most documented, fundamental skeletal construct.

the c++ model doesnt use ANY invert3x3 on the transforms.
It uses it once, on the vertices, but the keyframe rotations are not subject to rotations.

http://rsn.gamedev.net/tutorials/ms3danim.asp

Thats the website.

The c++ version seems to be column major...

// Matrix data, stored in column-major order

float m_matrix[16];



Whoever provides the solution to my problem, will be held in very high regard by me:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Order differs from row to column major. Maybe this causes some of the problems. Have look here: http://steve.hollasch.net/cgindex/math/matrix/column-vec.html

QuoteEgon, is your implementation of matrices standard?
Yes, standard for row major.

EgonOlsen

Maybe you can write a small test case, i.e. something that does the same thing like your skeletal code on one or two SimpleVectors and that compares the outcome to what was actually expected as a result.

cyberkilla

Okay, I will do that:).

I am currently converting the matrix class into java.
Interestingly, there is a similar problem with this too.

I think I had better add support for multiple bone assignments,
because the strange effects *may* be related.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

raft

cyberkilla, i just wanna be sure what you're doing exactly: you load both mesh and skeleton from ogre's xml format right ? (you dont use any of jPCT's loaders) then i guess you're right: coordinate system and clockwise/counter-clockwise issue shouldnt matter since all are in the same object space. all mechanism should work, possibly in wrong direction/axis, but it should work, isnt it?

so may it be that you miss-interpret ogre3d format ? for instance something related to quaternion-matrix issue ?

cyberkilla

Yes, you understand perfectly;).
I do not think it could be a problem either.

I have managed to make it move in the "general" correct direction, but it is  bu no means accurate.

I think I will use quaternions too, because the euler to matrix, to rotation vector is subject to a strange 90 degree issue(flips axis after a certain rotation).

EDIT:
Yup, im going to use quaternions with angle axis, because it looks like im being hit be "gimbal lock". I wondered what this meant, so I read about it, and it looks familiar.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG