Why is this impossible? (I use 1.4.9, I didn't check the newer versions, but I guess it's still unavailable)
This way (only MovableObject's can be attached to Bones) how can I modify dynamically a translation/rotation to Bone? -> (ok, i figured it out -> with the attachObjectToBone's return: TagPoint - which is not compatible with SceneNode...)
And why isn't this handled? -> I got runtime error (R6025) when I tried to attach a Node with Bone's addChild() !!!
--> And the main problem: How can I add an object to an object which is atteched to a bone -> e.g.: I attach a gun to a man's hand -> how can I attach another object to the gun? (e.g. a bullet, relative to the gun - it's just an example)
Attach a Node to a Bone
-
ShadeOgre
- Gremlin
- Posts: 158
- Joined: Mon Mar 10, 2008 10:55 pm
- Location: Budapest, Hungary
- x 1
Attach a Node to a Bone
Last edited by ShadeOgre on Fri May 29, 2009 1:37 pm, edited 2 times in total.
-
ShadeOgre
- Gremlin
- Posts: 158
- Joined: Mon Mar 10, 2008 10:55 pm
- Location: Budapest, Hungary
- x 1
Re: Attach a Node to a Bone
Additionally:
Why TagPoint's header isn't in the Ogre.h -> why should I include OgreTagPoint.h separately?
Why TagPoint's header isn't in the Ogre.h -> why should I include OgreTagPoint.h separately?
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Re: Attach a Node to a Bone
This was to prevent chains-of-chains-of-chains of nodes which get very expensive to make sure they're all up to date. An object attached to the bone of an entity becomes subsumed into it from the point of view of the SceneManager, which is different to a SceneNode which can have a very separate identity.
It's pretty unusual to want to attach bullets to guns, since they move separately - what you really want to do is get the starting point and direction, and then attach the bullet to its own entirely separate SceneNode - these things can de derived from the TagPoint. If you want to record extra information alongside an object, which you want to then use to make decisions later on (such as exit offset), use MovableObject::setUserAny(), or if you like, create your own MovableObject subclass.
Ogre.h is just a convenience for beginners, we don't advise using it on large projects (including every single header will slow your compilation down). It's not guaranteed to include everything, just the most common headers. Serious users should be selectively including headers to speed up their compile times.
It's pretty unusual to want to attach bullets to guns, since they move separately - what you really want to do is get the starting point and direction, and then attach the bullet to its own entirely separate SceneNode - these things can de derived from the TagPoint. If you want to record extra information alongside an object, which you want to then use to make decisions later on (such as exit offset), use MovableObject::setUserAny(), or if you like, create your own MovableObject subclass.
Ogre.h is just a convenience for beginners, we don't advise using it on large projects (including every single header will slow your compilation down). It's not guaranteed to include everything, just the most common headers. Serious users should be selectively including headers to speed up their compile times.
-
ShadeOgre
- Gremlin
- Posts: 158
- Joined: Mon Mar 10, 2008 10:55 pm
- Location: Budapest, Hungary
- x 1
Re: Attach a Node to a Bone
Thank U for the fast reply!
1) I decided to make a workaround -> new class, derived from SceneNode, have to add a Bone reference to it, and overridden _update -> in every update it synchronizes it's data with the Bone referenced to it; the SceneNodes I want to attach to a Bone create (if not created) this type of SceneNode then attach themselves to it. Untill now this seems to work, and additionally I can controll what datas of the Bone have to be syncronized with the special SceneNode.
2) I added Ogre.h to the precompiled header -> was it a wrong decision? Should I add every include separatly?
1) I decided to make a workaround -> new class, derived from SceneNode, have to add a Bone reference to it, and overridden _update -> in every update it synchronizes it's data with the Bone referenced to it; the SceneNodes I want to attach to a Bone create (if not created) this type of SceneNode then attach themselves to it. Untill now this seems to work, and additionally I can controll what datas of the Bone have to be syncronized with the special SceneNode.
2) I added Ogre.h to the precompiled header -> was it a wrong decision? Should I add every include separatly?
