Debugging Physics

Hi Guys,

I’m currently struggling with an issue regarding PhysicsNodes. I’m modelling a solar system, and I’ve created a class for my planets etc (see that builds two spheres and a physics node for the planet. The physics node is attached directly to the bulletAppState in Main. The two spheres are attached to a Node within my planet class.

I initialise these objects within another class called SolarSystem. This has a method which creates a planet at a specific location, and a sun. These objects are then attached to a node internal to the SolarSystem object. Lastly the solar system node object is attached to my rootNode in Main.

So the basic node chain is:

Planet/Sun > Node in Planet object > Node in SolarSystem object > rootNode

To get my specific locations for planets/sun, I specify setLocalTranslation on the “Node in Planet Object”. The node in my SolarSystem object gets attach at Vector3f.ZERO.

The problem I am running into now is that whilst my objects are showing up correctly. Only one of my Physics nodes is. I.e. I’ve created a solar system with 1 sun and 1 planet. They both show up fine, but only the physics node around my sun (at Vector3f.ZERO) is working. I can fly straight through my planet.

My questions would be:

  1. Am I doing things the right way with regard to my node chaining? Or should I be attaching everything directly to the rootNode?

  2. How can I debug my physics nodes? I’ve tried using .attachDebugShape() on them, but that doesn’t show up.

    Any help gratefully received! :slight_smile:

The Physics Nodes probably do show up, but if you dont attach the planets to them they cannot work for the planets… Or rather they wont move with it (why should they?). So I guess your Physics Nodes all land in the center at the beginning and “explode” due to the overlapping…

The logic should be RootNode->PhysicsNode->Planet Geometry

Normen, you are a genius. :slight_smile: (you probably get that a lot).

For some bizarre reason I hadn’t realised you should/could attach the physics node to the rootNode. I thought you only had to attach it to the bullerAppState.

Thank you!