Page 1 of 1

Entity Skeleton Animation

Posted: Mon Nov 05, 2018 7:05 am
by ProfessorJ
How would I go about adding an AnimationState to an existing entity, which has its own skeleton and animation states already?

I have added the animation to the skeleton and I can see that it increments when I call

Code: Select all

mBodyEnt->getSkeleton()->getNumAnimations()
But I don't know how to make it accessible using the following

Code: Select all

mBodyEnt->getAnimationState(...)

Re: Entity Skeleton Animation

Posted: Mon Nov 05, 2018 9:36 pm
by Lax
Hi,

you need to know your animation names, which are defined in a .skeleton file. After that just get the animation state from the given animation name.
For example:

Code: Select all

this->animationState = entity->getAnimationState("YourAnimationName");
if (this->animationState)
{
	this->animationState->setEnabled(true);
	this->animationState->setWeight(5.0f);
	this->animationState->setTimePosition(0.0f);
	this->animationState->setLoop(true);
}
...
Later in update loop call:
this->animationState->addTime(dt * speed / this->animationState->getLength());
There are also tutorial on the Ogre site:
http://wiki.ogre3d.org/Intermediate+Tutorial+1

Regards
Lax

Re: Entity Skeleton Animation

Posted: Mon Nov 05, 2018 11:19 pm
by ProfessorJ
Hi.

Thanks for your reply!

What I mean is, after loading a mesh with a skeleton file (which has one animation), then I programmatically add another animation to the skeleton. The entity still has the original animation only, can check this with mBodyEnt->getAllAnimationStates()->getAnimationStateIterator().

I will follow through the tutorial and see if that helps.

Re: Entity Skeleton Animation

Posted: Tue Nov 06, 2018 6:06 pm
by Lax
Hi,

try those methods to signal that something changes and will be re-initialized, although I do not know if it will work;

Code: Select all

entity->addSoftwareAnimationRequest(false);
entity->getAllAnimationStates()->_notifyDirty();
entity->_updateAnimation();
Regards
Lax

Re: Entity Skeleton Animation

Posted: Sat Nov 10, 2018 5:27 am
by ProfessorJ
That helped.. although the only was I could get it to work was with

Code: Select all

        mBodyEnt->_initialise(true);

Re: Entity Skeleton Animation

Posted: Tue Nov 20, 2018 2:38 pm
by just_try
hello
you said "you need to know your animation names, which are defined in a .skeleton file"
how I know because I open the file and I found some symbols I did not understand it?
give me a name of the software or something help me.and thanks?

Re: Entity Skeleton Animation

Posted: Tue Nov 20, 2018 9:16 pm
by areay
If you want to see the names of animations in the .skeleton file you can use the 'OgreXMLConverter' or 'OgreMeshTool' tools that come with ogre to convert your .skeleton file into a .skeleton.xml file that you can eyeball.

Re: Entity Skeleton Animation

Posted: Wed Nov 21, 2018 11:16 am
by just_try
thanks, for your reply :D

Re: Entity Skeleton Animation

Posted: Mon Nov 26, 2018 3:20 pm
by just_try
Hey again ..
I have a problem..i hope you can help me :(
I imported a virtual human in 3ds max (2015) and I applied a movement ('Walk')(. * bip) .. everything works well in 3Ds Max..
but when I export this entity by (Ogre max) to use it in my 'visual studio' code ..
I can not find the name of the animation performed in the (.skelton) file..Why?
?