Entity Skeleton Animation

Problems building or running the engine, queries about how to use features etc.
Post Reply
ProfessorJ
Gnoblar
Posts: 16
Joined: Tue Aug 14, 2007 6:49 am
Location: Australia

Entity Skeleton Animation

Post by ProfessorJ » Mon Nov 05, 2018 7:05 am

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(...)
0 x

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

Re: Entity Skeleton Animation

Post by Lax » Mon Nov 05, 2018 9:36 pm

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

ProfessorJ
Gnoblar
Posts: 16
Joined: Tue Aug 14, 2007 6:49 am
Location: Australia

Re: Entity Skeleton Animation

Post by ProfessorJ » Mon Nov 05, 2018 11:19 pm

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

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

Re: Entity Skeleton Animation

Post by Lax » Tue Nov 06, 2018 6:06 pm

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

ProfessorJ
Gnoblar
Posts: 16
Joined: Tue Aug 14, 2007 6:49 am
Location: Australia

Re: Entity Skeleton Animation

Post by ProfessorJ » Sat Nov 10, 2018 5:27 am

That helped.. although the only was I could get it to work was with

Code: Select all

        mBodyEnt->_initialise(true);
0 x

just_try
Gnoblar
Posts: 6
Joined: Tue Mar 13, 2018 8:24 pm

Re: Entity Skeleton Animation

Post by just_try » Tue Nov 20, 2018 2:38 pm

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

User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ

Re: Entity Skeleton Animation

Post by areay » Tue Nov 20, 2018 9:16 pm

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

just_try
Gnoblar
Posts: 6
Joined: Tue Mar 13, 2018 8:24 pm

Re: Entity Skeleton Animation

Post by just_try » Wed Nov 21, 2018 11:16 am

thanks, for your reply :D
0 x

just_try
Gnoblar
Posts: 6
Joined: Tue Mar 13, 2018 8:24 pm

Re: Entity Skeleton Animation

Post by just_try » Mon Nov 26, 2018 3:20 pm

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

Post Reply