newbie - multiple nodes from one entity

chriso

10-12-2005 21:18:53

is it possible?

I have it working fine when I create many mesh entities, but was wondering if I could use one entity and multiple nodes (some code below).

Also if you are interested, I am documenting the process of going from a Python and Ogre beginner on a blog, where I will post my code and experiments:
http://pyogre.blogspot.com/



from pyogre import ogre
import SampleFramework

class TutorialApplication(SampleFramework.Application):
def _createScene(self):

sceneManager = self.sceneManager
sceneManager.ambientLight = (1, 1, 1)

ent1 = sceneManager.createEntity("Robot", "robot.mesh")

nodes = []
for i in range(0, 5):

name = "RobotNode_" + str(i)
nodes.append(sceneManager.rootSceneNode.createChildSceneNode(name, (i*100, 0, 0)))
nodes[i].attachObject(ent1)

if __name__ == '__main__':
ta = TutorialApplication()
ta.go()

Clay

10-12-2005 22:17:24

An entity can only have one parent node. If you want to place multiple copies of a particular mesh around the scene, simply create multiple entities and attach them to various SceneNodes. Only one copy of the mesh that defines them is stored in memory.

Nice blog. =)