Page 1 of 1

Bone rotation

Posted: Wed Feb 10, 2010 12:25 pm
by cafe_ole
Hi, I want to rotate an arm of a model made in Blender. In Blender it works fine with an armature definition but when if I export it to Ogre seems like shoulder bone has another pivot to rotate because the movement is not correct. Can I set pivot rotation in Ogre or I have to do it in Blender?? I have tried to put the shoulder axis on 0,0,0 in Blender but it doesn't work. Thanks!

Code:

Code: Select all

 //PITCH + (TECLA U)
		if(mKeyboard->isKeyDown(OIS::KC_U)){
			boneHombro->pitch(Degree(evt.timeSinceLastFrame*100), Node::TS_LOCAL);
		}
		//PITCH - (TECLA Y)
		if(mKeyboard->isKeyDown(OIS::KC_Y)){
			boneHombro->pitch(Degree(-evt.timeSinceLastFrame*100), Node::TS_LOCAL);	
		}

		//YAW + (TECLA J)
		if(mKeyboard->isKeyDown(OIS::KC_J)){
			boneHombro->yaw(Degree(evt.timeSinceLastFrame*100), Node::TS_LOCAL);
		}
		//YAW - (TECLA H)
		if(mKeyboard->isKeyDown(OIS::KC_H)){
			boneHombro->yaw(Degree(-evt.timeSinceLastFrame*100), Node::TS_LOCAL);	
		}
		
		//ROLL + (TECLA M)
		if(mKeyboard->isKeyDown(OIS::KC_M)){			
			boneHombro->roll(Degree(evt.timeSinceLastFrame*100), Node::TS_LOCAL);
		}
		//ROLL - (TECLA N)
		if(mKeyboard->isKeyDown(OIS::KC_N)){
			boneHombro->roll(Degree(-evt.timeSinceLastFrame*100), Node::TS_LOCAL);	
		}

INCORRECT MOVEMENT IN OGRE:
Ogre.JPG
Ogre.JPG (42.2 KiB) Viewed 1907 times
CORRECT MOVEMENT IN BLENDER:
Blender.JPG
Blender.JPG (36.64 KiB) Viewed 1907 times

Re: Bone rotation

Posted: Thu Feb 11, 2010 9:37 am
by cafe_ole
My problem si similar to this:

http://www.ogre3d.org/forums/viewtopic. ... ion#p81634

I have understood that it is a exporter problem...but I'm not sure :(

Re: Bone rotation

Posted: Thu Feb 11, 2010 5:51 pm
by kraj0t
All I can tell you is... ouch, that seems to hurt ^__^U

Re: Bone rotation

Posted: Thu Feb 11, 2010 8:40 pm
by koirat
Show us your armature in blender.

Are you sure your bones are parented correctly.
This bone rotation that you are showing us in blender is in edit or in pose mode ?

Re: Bone rotation

Posted: Fri Feb 12, 2010 11:38 am
by cafe_ole
Bone rotation in Blender is in pose mode. I have solved the problem changing the orientation and the scale of body bone (bone that is the reference to rotate shoulder bone). Thanks :)

Re: Bone rotation

Posted: Sun Aug 29, 2010 7:50 am
by pyClass
cafe_ole, I'm having exactly the same problem.

My simple Blender model behave strangely in Ogre when manually controlling bones. Some bones rotate as expected while others seems to have the pivot incorrectly positioned. I have tried to fix it by manually positioning the bone using Bone::_setDerivedPosition() but no matters what values I use, the bone still rotate as orbiting the entity center.

Some images showing the problem:

Ogre window: the arm rotates as if the center of ration is the entity center or near it. While the leg rotates as it must do.
Image

Blender
Image

Can I see a wire frame render of your model with all bones selected?
Also, can you tell exactly what you did to bones data? I have tried to rotate and scale the root bone and the bone parent to the conflicting ones, in edit mode, and nothing changed.

Re: Bone rotation

Posted: Wed Sep 01, 2010 9:49 am
by cafe_ole
Hi, I have solved the problem rotating bone around another. For example, your bone arms need to have a parent pivot bone to rotate. So you have to join your arm bones to your body bone or add some pivot bone to rotate them.
model.JPG

Re: Bone rotation

Posted: Fri Sep 03, 2010 11:54 pm
by pyClass
Thank you, I have tried to change my armature design to be sure there is no disconnected bones (I parented my shoulder bones to a new small bone that connect to the body bone), not only unparented ones, but that didn't solve my problem. Also I found that legs bones are not rotating correctly after all, but as they are near the root bone I didn't notice the small error before.

I opened the skeleton.xml file generated by exporter and bone positions seems not correctly to me. I tried manually edit the values, taking into account that ogre y axis is blender z axis, but still the pivot used to rotate the bones is incorrect.

I will have to create a new thread as this problem seems to be a different one than yours after all.

Update: I have found the problem. It was similar to yours after all. During modeling I scaled my model in Object Mode, but the Exporter ignores Object Mode scaling. I placed bones of armature on top of the scaled model (bad idea). I used the Transform Properties Window (in Blender, press N key with model selected in Object Mode) and reset all axes scale to 1.0 then reposition bones on top of the bigger model. That's all. Anyway, the bones are still placed wrong in skeleton.xml, but it seems it is normal and do not prevent to get the expected deformation.

Re: Bone rotation

Posted: Mon Sep 06, 2010 9:36 am
by cafe_ole
Also you can do in Object Mode in Blender, Object->Clear/Apply->Apply Scale/Rotation to ObData with the mesh selected to export the bones scalled :)