When i’m attaching a Geometry to a PhysicsNode through attachChild() the PhysicsNode doesn’t get rendered any more. Only the attached Geometry. When i manually set the material(SolidColor) of the Spatial that belongs to the PhysicsNode than it gets rendered again but as you can imagine not with correct material/texture. Is there a way to tell jme3 that he should render the spatial that belongs to the PhysicsNode? Or is there a way to tell jme3 that he shouldn’t render the Geometry without detaching it?
I dont understand, Only Geometry is visible and can be rendered.
The spatial that i give the PhysicsNode in the constructor should be rendered too but isn’t when i’m attaching a geometry per attachChild().
PhysicsNode pn = new PhysicsNode(spatial, some CollisionShape, mass)
Hm, never had that happening. The spatial you supply with the constructor is also just a child. Does it happen when you simply add both normally with attachChild() and dont use the constructor?
I think i have done something wrong with updateGeometricState. I try to find it out.
You should not be doing anything with updateGeometricState() https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:updategeometricstate
But he often comes with this exception when i don’t update:
Exception in thread “LWJGL Renderer Thread” java.lang.IllegalStateException: updateGeometricState() must be called on the root node to retrieve updated world transforms.
at com.jme3.scene.Spatial.checkUpdatedTransform(Spatial.java:250)
at com.jme3.scene.Spatial.getWorldTranslation(Spatial.java:273)
Yes, its all described in the wiki page. You probably need to reorganize your update order if you often need to recalculate this.
It was an updateGeometricState() problem. And it was a real bitch this little updateGeometricState() ;). Took me nearly 4 hours to find the problem and it caused a lot of weird problems. So remember kids: Don’t fuck with updateGeometricState() ;). And a thanks to normen for his patience.
But it’s ok to call it before attaching the geometry or whatever to the rootNode?
Yes, its no problem calling it on a spatial that has no parent.