Some lines confuse me.... are the same??

digimikeh

21-02-2009 00:01:21

Hi there...

I want to know if this two ways to script are the same or means different things..

Type A
entA = sceneManager.createEntity ('Ninja', 'ninja.mesh')
entA.castShadows = True
sceneManager.getRootSceneNode().createChildSceneNode ().attachObject (entA)



Type B

entA = sceneManager.createEntity("Ninja", "ninja.mesh")
nodeA = sceneManager.getRootSceneNode().createChildSceneNode("NinjaNodeA")
nodeA.attachObject(entA)
entA.castShadows = True


should be that Type A is in one line resumed those written in Type B ?

andy

21-02-2009 00:56:38

They basically do the same -- Only real difference is that in 'B' the childscenenode is created with a name that potentially could be useful in other parts of the code..

Have a look at the Ogre documentation for more information on creating nodes etc..

Andy

digimikeh

21-02-2009 01:27:12

Thank you!... i'm clear now... now reading documentation.... if are the same... personally prefer way B...

afecelis

23-02-2009 21:19:56

Hi everyone! This is my first post.
In type A you're just declaring an entity to load a mesh in the scenemanager, in type B too, but you're attaching a node to it (making it a child of the scenemanager) in order to manipulate it further (position, scale, rotation, etc).

I also prefer type B to load and declare stuff. I feel it's a bit more understandable that way :)

regards,

Alvaro

digimikeh

24-02-2009 02:48:52

thanks alvaro..... :D