[2.1] Play animation from multiple files

Problems building or running the engine, queries about how to use features etc.
Post Reply
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

[2.1] Play animation from multiple files

Post by 123iamking »

In the Ogre 2.1 sample Sample_AnimationTagPoint, I see that we can use the function

Code: Select all

SkeletonAnimation* SkeletonInstance::getAnimation( IdString name );
to get the animation in the Stickman.skeleton file. But how about I want to get the animation from other files?
Like I got a model:
+ Player.mesh
and a punch of animation files:
+ Attack.skeleton
+ Drunk.skeleton
+ Angry.skeleton
I want to make Player play animation in these animation files instead of Player.skeleton.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Play animation from multiple files

Post by dark_sylinc »

I'd strongly advise against storing animations like this.
It's not the way Ogre intends you to use them (all animations should be in the same skeleton file) so it could be inefficient and you'll find friction.

That being said, if the skeletons are the same and only the animations are different, see ImportAnimationsShareSkeletonInstance sample.
The functionality is actually meant for RPGs though, where a user can change armour, and the armour Item could share and follow the animations from the main body, but it may work for doing something like what you ask.
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: [2.1] Play animation from multiple files

Post by 123iamking »

Thank you dark_sylinc :)
My purpose is a lot of model files (.mesh) share 1 animation file (.skeleton). Like in the game GTA (f.e Vice city), all the pedestrians in a group share the same animation. I think Ogre must allow you to do this.
Anyway, I will dig in the tutorial Sample_ImportAnimationsShareSkeletonInstance :D You are awesome dark_sylinc!

Edit: Wait a minute, to archive something like the GTA example above, just set the skeletonlink tab in the xml file is enough

Code: Select all

<skeletonlink name="CommonPed.skeleton" />
Anyway, In GTA 5, some animations of the player do require to load before using and destroy after done using. So I think it's still necessary to store some mission-special-animations in separated animation file.
Post Reply