Getting crazy with bones orientation

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

Getting crazy with bones orientation

Post by Lax » Thu Feb 07, 2019 10:31 pm

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
0 x

rpgplayerrobin
Gremlin
Posts: 151
Joined: Wed Mar 18, 2009 3:03 am
x 16

Re: Getting crazy with bones orientation

Post by rpgplayerrobin » Fri Feb 08, 2019 6:17 am

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();
}
1 x

Lax
Gnome
Posts: 356
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: Getting crazy with bones orientation

Post by Lax » Sun Feb 10, 2019 8:18 pm

Hi,

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

Thanks!

Best Regards
Lax
0 x

Post Reply