Ogre3D Scene node position

Started by
3 comments, last by Amrazek 14 years, 8 months ago
Hello, I have a question. Lets take for example 2 classes in Ogre: SceneNode who is inherited from Node, and hmm Light who is inherited from MovableObject. SceneNode can have any number (right?) of other SceneNodes attached to it, and together they make a Scene Graph. SceneNode also can have any (right?) number of MovableObjects attached to it. One thing I could not find in Ogre tutorial is why both Scene Node and Light have positions? Why Entity for example dont have position? Is SceneNode can be referred to some kind of Group? Like for example lets say I modeled a knight and a horse. To make them move together I put them into one node right? This why they dont need position? And if knight is holding a light torch then I add the torch model to the same Node and add also Light with position of the top of the torch? I got it correct? The lights position is position relative to the node position right? Thanks for help :)

I would love to change the world, but they won’t give me the source code.

Advertisement
I am a Ogre noob myself, but it appears to me that all the things you said are correct, except for the Scene Graph thing which I don't know if it's true or not.

Why lights have a position and entities do not, I don't know, but it is that way. All positions are relative to their parent. So first you make a node the child of something, then you set the childs coordinates to zero, which centers the child onto the parent.

All movement which you do to the parent, always also happens to the child. All nodes which are children of the "root" sceneNode are sortof in global space, and move in their own. So to say.

I advice you to ask further questions in the Ogre forum at ogre3d.org, since there's way much more people around to answer your questions quickly.
----------------------~NQ - semi-pro graphical artist and hobbyist programmer
Yeah, ask on the Ogre forums next time, I frequent them a lot more [grin].

But you're right on all of your points. It's only for an offset (which could otherwise be achieved by having an intermediate node for the light which could be used as an offset instead of using the light itself). Same thing with Ogre::Camera - you aren't required to attach it to a node, but it's usually a good idea.
Ok thanks :)

I would love to change the world, but they won’t give me the source code.

Entity doesn't have a position because it must always be attached to a SceneNode. A SceneNode with a position and an Entity with a different position wouldn't make sense.
Quote:
One thing to note about Ogre is that it separates renderable objects from their location and orientation. This means that you cannot directly place an Entity in a scene. Instead you must attach the Entity to a SceneNode object, and this SceneNode contains the information about location and orientation.


Lights can have positions because you aren't required to attach them to a SceneNode.

Quote:Is SceneNode can be referred to some kind of Group? Like for example lets say I modeled a knight and a horse. To make them move together I put them into one node right? This why they dont need position? And if knight is holding a light torch then I add the torch model to the same Node and add also Light with position of the top of the torch? I got it correct?

In this case, you could create a SceneNode with a horse mesh attached to the root SceneNode, and then add two more SceneNodes as children of the horse's node (ideally, the torch would be a child of the knight instead though) and then any rotations/position changes to the horse would affect the horse and all children SceneNodes.
If I put my 2 cents in and get a penny for my thoughts, where does my other penny go?

This topic is closed to new replies.

Advertisement