Getting crazy with bones orientation

Problems building or running the engine, queries about how to use features etc.
Post Reply
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Getting crazy with bones orientation

Post by Lax »

Ogre Version: :?: 2.1
Operating System: :?: Windows 10
Render System: :?: DirectX

Hi,

I'm getting crazy with the ogre bones orientation handling. I want to do the following:

I just want to set the orientation of the foot of a character to the rise of the environment. I do the following:

- Get bone from left and right foot of a character
- reset bone
- store initial orientation of left and right bone
- setInheritOrientation(false) in order to set orientation on global space

Code: Select all

leftFoot->setDerivedOrientation(Ogre::Quaternion(Ogre::Degree(rise), Vector3::UNIT_X)));
But as soon as I set setInheritOrientation to false. Things are going to be crazy, the foot are rotated at a high rate. When I stop everything, i want to reset the bones and also set 'setInheritOrientation ' to false, but the foot will not set its initial state.

The value of the variable 'rise' is calculated correctly. I checked that.

Why is that solved that complicated in ogre? Does anyone have an example how to solve this?

I tried nearly everything. I also played around with convertWorldToLocalOrientation and convertLocalToWorldOrientation

Thanks in advance
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

rpgplayerrobin
Gnoll
Posts: 619
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: Getting crazy with bones orientation

Post by rpgplayerrobin »

When I first added manual bones to an entity I got almost the same kind of problem (in this case the position went wild instead).
If you try the same way I do it, does it work for you?

At creation of the entity:

Code: Select all

// Get the bone
string tmpBoneName = "chest";
if(m_ent->hasSkeleton() && m_ent->getSkeleton()->hasBone(tmpBoneName))
{
	m_boneChest = m_ent->getSkeleton()->getBone(tmpBoneName);

	// Set the bone to be manually controlled
	m_boneChest->setManuallyControlled(true);
	m_boneChest->reset();
}

On update:

Code: Select all

if(m_boneChest)
{
	// You could do any rotation here I believe, not sure about the function you are using though
	m_boneChest->reset();
	m_boneChest->yaw(Degree(tmpDegree), Node::TS_WORLD); 

	// Update the animation (I do this here because I later place things on bones of the entity manually)
	m_model->m_ent->_updateAnimation();
}
Lax
Hobgoblin
Posts: 583
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 50

Re: Getting crazy with bones orientation

Post by Lax »

Hi,

yeah the reset in each frame and after that setting orientation helped.

Thanks!

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

Post Reply