Okay, the scene system uses nodes.
IAnimatedMeshSceneNode
My game is first person. Should each entity in the game have its own node, or can/should I be putting them under the same node? How are they best used?
Using Scene Nodes
You typically create scene nodes that are children of the root scene node. This happens automatically if you specify a NULL parent pointer when you call add*SceneNode*.
If you make a node a child of some other scene node it will move and rotate with its parent. The nodes are attached, similar to the way wheels are attached to a car. If you pick up the car and move it around, the wheels and tires stay in the same position relative to the car itself. This does not happen for nodes that are not in an ancestor/child relationship.
Travis
If you make a node a child of some other scene node it will move and rotate with its parent. The nodes are attached, similar to the way wheels are attached to a car. If you pick up the car and move it around, the wheels and tires stay in the same position relative to the car itself. This does not happen for nodes that are not in an ancestor/child relationship.
Travis
-
TunaBreeze
- Posts: 8
- Joined: Fri Apr 27, 2007 1:20 am
Well the new question seems even more confusing than the first... You would create a new node for each instance. How would you use the same scene node for every instance of the same object?
Say you had a dozen zombies walking around a level. If you have 12 zombie nodes, the position and orientation of each of them is kept seperate, and they would each be rendered automatically by the scene manager.
If you use the same scene node for all 12 zombies, you would have to move the scene node and render it 12 times. You would have to do this manually, and you would have to store the position and orientation of each zombie seperate from the scene node.
Travis
Say you had a dozen zombies walking around a level. If you have 12 zombie nodes, the position and orientation of each of them is kept seperate, and they would each be rendered automatically by the scene manager.
If you use the same scene node for all 12 zombies, you would have to move the scene node and render it 12 times. You would have to do this manually, and you would have to store the position and orientation of each zombie seperate from the scene node.
Travis
-
TunaBreeze
- Posts: 8
- Joined: Fri Apr 27, 2007 1:20 am
As you can see IAnimatedMeshSceneNode is created from IAnimatedMesh using ISceneManager::addAnimatedMeshSceneNode (...).
IAnimatedMesh is created from your model file (x, 3ds, ...) using ISceneManager::getMesh(...).
So say you want dozen zombies walking your lewel and you have one zombie.x file. You create one mesh from your zombie.x and then use that one mesh to create dozen zombie nodes. All your zombie nodes will share the same mesh however they can be placed, animated, scaled, rotated individualy.
IAnimatedMesh is created from your model file (x, 3ds, ...) using ISceneManager::getMesh(...).
So say you want dozen zombies walking your lewel and you have one zombie.x file. You create one mesh from your zombie.x and then use that one mesh to create dozen zombie nodes. All your zombie nodes will share the same mesh however they can be placed, animated, scaled, rotated individualy.