Global rotation of joints

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Global rotation of joints

Post by B@z »

Hi
i have a problem with rotation joints.
is it possible to rotate joint like in the modelling software when using global rotation.
i want to make my character's back point to a special direction (when shooting up, i want my character's back rotating up, etc)
thanks
Image
Image
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

help please >< (bump)
Image
Image
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

i have a problem with rotation joints.
is it possible to rotate joint like in the modelling software when using global rotation.
i want to make my character's back point to a special direction (when shooting up, i want my character's back rotating up, etc)
Why do you need global for that?
multum in parvo
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

ok let me explain u with pictures.
http://dotdotdot.site90.com/FTP/pic1.jpg
the first picture the shooting with pistol. as u see, i have to rotate it on the X axis, to make it point up or down

http://dotdotdot.site90.com/FTP/pic2.jpg
second picture is the revolver shooting. as u see, if i rotate on the X axis ( http://dotdotdot.site90.com/FTP/pic3.jpg picture 3) it seems bad.

http://dotdotdot.site90.com/FTP/pic4.jpg
4th picture shows what happens if i rotate on a global X axis. everything ok.

i want to achieve that rotation
Image
Image
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

Sorry your pictures aren't helping me much. What bone are you trying to rotate? You should be able to rotate that bone with setRotation(). Just get the rotation of the bone you want to rotate and rotate it by however much you want.
multum in parvo
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

If you really need global you can try using getAbsoluteTransformation() and get the rotation from the matrix using getRotationDegrees().
multum in parvo
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

um... just check pic2 and pic3.
and check the arrow
the camera is from front. see where does the X axist point? if i rotate on that axis, the arm of my model wont point to center, but will move left or right (pic3)
ill make you a better picture
http://dotdotdot.site90.com/FTP/pic5.jpg
a little explainment: the first picture is the normal. check the red line, thats the line where the arm should move.
the second picture is the rotating on local space (how setRotation works).
see the arm? its moving to side. thats fugly
third picture is the rotating on global space (what i want to achieve), the arm is perfectly on the line, and looks good!
Image
Image
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

oh posted before reading ur second post.
with getAbsoluteTransformation i can GET the global rotation, but i want to SET it on a global axis
i dont know how to calculate that rotation.
Image
Image
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

If you set the rotation, this is relative to its parent. If you don't have a parent for that node, rotation is global. Rotation is not changed incrementally!
I would try setting the bone you are trying to rotate to have no parent and call setRotation().
multum in parvo
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

yeah and then if i rotate my character (for example when falling back), then my characters torso wont move..
....
ok lets start it from the beginning.
if u open a modeling software. u make a skeleton.
u select a joint. press rotation. then u can change either rotating locally (irrlicht setRotation function), or rotating globally.
that is what i want to achieve. the rotating on global axis.
can anyone help me with that?? (and not asking "why u need that" etc)
Image
Image
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

The IBoneSceneNode* has a member function setSkinningSpace, and you can pass global to it. E.G.

Code: Select all

IBoneSceneNode* bone = node->getJointNode(0);
bone->setSkinningSpace(EBSS_GLOBAL);
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

hm i see no difference
i tried either

Code: Select all

			IBoneSceneNode* back = upperAnimNode->getJointNode("hip_up");
			if (back)
			{
				vector3df currot = back->getRotation();
				back->setSkinningSpace(EBSS_GLOBAL);
				back->setRotation(vector3df(currot.X+vertical, currot.Y, currot.Z));
			}
or setting the skinning space when loading. it was absolutely same as when i set it to EBSS_LOCAL
Image
Image
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

any other ideas? (bump!)
Image
Image
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

am i trying the impossible!?
Image
Image
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

I looked at your pictures again and i don't see why you can't do that with setRotation(). It looks to me that your axes are swapped or something. Try switching the axes around until you get it to move up and down instead of side to side.
multum in parvo
Post Reply