Automatically adding bodies from scene to physics space


#1

Hello!

There is a scene including multiple models with CharacterControls. What is the easiest way to add all of them to the BulletAppState physical space? Is it necessary to loop the children of the scene, find all nodes with CharacterControls and add them to the physical space?


#2

just add them when you create them / add them to Node, or if you prepare earlier, then add on cloning, or create own control for spatial that will determine when to add or remove(for example add physics only if close to player)

there are many ways depends what you need.


#3

I think he’s building his whole scene in the scene composer. In which case, I think there is no way around the four lines of code to search the scene graph and add stuff to the physics space.


#4

Thank you for the replies, both of your answers have given me better understanding.


#5
     physicsSpace.addAll(rootNode);