Hello everyone.
Few days ago I posted a question on the Help forum about the possibility to use the same node animation for several nodes. IE : having one Animation object with one NodeTrack and be able to use it for several nodes, and not only the node associated with the track.
After digging Ogre code, it look like there is no easy way do to that (or maybe there is and I missed it ?). The only way I found to achieve that is rather dirty. It imply allocating Animation object myself and update them myself. I think adding a feature to do that easily would be a good thing. With your agreement I'm whiling to implement it and submit a patch.
Allow me to give more details about what I need this for. I have an element composed of several nodes with a node animation stored into a .scene file. I have to put many instances of this element into my scene, and I want all of them to be animated (but not necessarily synchronized). So far, the only proper way I've found to do that is to use the scene manager to create one scene animation for each element. That mean having a lot of copies of the same animation in ram, what a waste ! That's why I'm looking for a way to have only one animation for all my elements. Ideally, each element would have its animationState so it can control his own animation the way it wants to.
What do you think ?
Use the same node animation for many nodes
- Souvarine
- Halfling
- Posts: 79
- Joined: Mon Apr 28, 2008 12:01 am
- Location: France
- x 5
-
nbeato
- Gnome
- Posts: 372
- Joined: Thu Dec 20, 2007 1:00 am
- Location: Florida
- x 3
- Contact:
Re: Use the same node animation for many nodes
Why can't you just parent all of your objects under one animated node? That works for us. You can also use TagPoints and attach nodes to the bones of a skeleton if you want to allow a node to follow specific bones.
- Souvarine
- Halfling
- Posts: 79
- Joined: Mon Apr 28, 2008 12:01 am
- Location: France
- x 5
Re: Use the same node animation for many nodes
If I did that then all my nodes would be synchronized with each others and that's not what I want. I want each object to be able to control it's animation the way it wants to.
- RedEyeCoder
- Gnome
- Posts: 344
- Joined: Sat Jun 16, 2007 7:29 am
- Location: Brisbane, Australia
Re: Use the same node animation for many nodes
Hi 
The function you are looking for is NodeAnimationTrack::applyToNode.
You will probably need to make a small helper object that keeps time/node/animation and has a little update/tick function, but its all very easy.
GL!
The function you are looking for is NodeAnimationTrack::applyToNode.
You will probably need to make a small helper object that keeps time/node/animation and has a little update/tick function, but its all very easy.
GL!
- Souvarine
- Halfling
- Posts: 79
- Joined: Mon Apr 28, 2008 12:01 am
- Location: France
- x 5
Re: Use the same node animation for many nodes
Yup, applyToNode, that's what I found out when I dug the source code. That's probably what I'm going to use in the end. But it's not really handy, I have to create Animation objects myself (even if the doc clearly say I shouldn't), as well as AnimationState end AnimationStateSet. And then I have to copy the code from SceneManager::_applySceneAnimations into my own. I agree it's not really difficult to do once you understand how the whole thing works. But I think Ogre could have a cleaner and easier way to do that. Hence my feature request.
Anyway, thanks you all for your answers.
Anyway, thanks you all for your answers.