can i attach a subentity to scenenode?

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
watermoon123
Gnoblar
Posts: 8
Joined: Thu Jan 22, 2015 9:17 am

can i attach a subentity to scenenode?

Post by watermoon123 »

i want to rotate a turret of a tank, (and i have never used bone animation,is it difficult?)
i can do this by split the model to two models and then control them divide, but if there are many subentity need to move, it's maybe troublesome.
so can i attach a subentity to a scenenode?
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: can i attach a subentity to scenenode?

Post by Kojack »

Subentities are designed to separate an entity into parts with different materials, but are part of the same whole. They can't be moved individually and scenenodes don't understand them.
However using bones you can effectively move them, if all vertices in a subentity are attached to the same bone then it will act like a scene node. A bone is actually a sibling to scene node, they both inherit from Node, so they share the same methods.

The most efficient way is if you use just one material (so one subentity for the whole tank) and use bones to control it. That would be one render call instead of two (each subentity takes one call and will slow things down, while many bones can be used in one call).

Using separate entities for each part and putting them on scene nodes may be easier to do, but won't be as fast as bones.
watermoon123
Gnoblar
Posts: 8
Joined: Thu Jan 22, 2015 9:17 am

Re: can i attach a subentity to scenenode?

Post by watermoon123 »

thank you for your advice!
using bone need .skeleton file?
i just have .mesh file
(it's my first time to use ogre forums,i dont know if you can see my reply...)
Post Reply