Bone rotation

Problems building or running the engine, queries about how to use features etc.

Bone rotation

Postby cafe_ole » Wed Feb 10, 2010 12:25 pm

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 1133 times


CORRECT MOVEMENT IN BLENDER:

Blender.JPG
Blender.JPG (36.64 KiB) Viewed 1133 times
cafe_ole
Halfling
 
Posts: 53
Kudos: 0
Joined: 04 Sep 2009

Re: Bone rotation

Postby cafe_ole » Thu Feb 11, 2010 9:37 am

My problem si similar to this:

http://www.ogre3d.org/forums/viewtopic.php?f=2&t=11364&p=81634&hilit=bone+rotation#p81634

I have understood that it is a exporter problem...but I'm not sure :(
cafe_ole
Halfling
 
Posts: 53
Kudos: 0
Joined: 04 Sep 2009

Re: Bone rotation

Postby kraj0t » Thu Feb 11, 2010 5:51 pm

All I can tell you is... ouch, that seems to hurt ^__^U
kraj0t
Halfling
 
Posts: 89
Kudos: 0
Joined: 15 Mar 2009
Location: Seville (Spain)

Re: Bone rotation

Postby koirat » Thu Feb 11, 2010 8:40 pm

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 ?
This is a block of text that can be added to posts you make. There is a 255 character limit.
User avatar
koirat
Orc
 
Posts: 446
Kudos: 13
Joined: 25 Feb 2008

Re: Bone rotation

Postby cafe_ole » Fri Feb 12, 2010 11:38 am

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 :)
cafe_ole
Halfling
 
Posts: 53
Kudos: 0
Joined: 04 Sep 2009

Re: Bone rotation

Postby pyClass » Sun Aug 29, 2010 7:50 am

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.
Ogre 1.7.1
User avatar
pyClass
Gnoblar
 
Posts: 2
Kudos: 0
Joined: 29 Aug 2010

Re: Bone rotation

Postby cafe_ole » Wed Sep 01, 2010 9:49 am

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
cafe_ole
Halfling
 
Posts: 53
Kudos: 0
Joined: 04 Sep 2009

Re: Bone rotation

Postby pyClass » Fri Sep 03, 2010 11:54 pm

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.
Attachments
DProyectospythonogre-1.7.1-r1125scriptmain.png
Shows an Ogre render of the model with debug bones (a model of a bone of 1.0 long render as overlay, it is useful for show bone orientation, if you scale it to the head of the next bone you get size too, but I'm too lazy for that)
Ogre 1.7.1
User avatar
pyClass
Gnoblar
 
Posts: 2
Kudos: 0
Joined: 29 Aug 2010

Re: Bone rotation

Postby cafe_ole » Mon Sep 06, 2010 9:36 am

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 :)
cafe_ole
Halfling
 
Posts: 53
Kudos: 0
Joined: 04 Sep 2009


Return to Help

Who is online

Users browsing this forum: Bing [Bot] and 5 guests