@t0neg0d said:
[java]
bb.setSpatial(txt);
bb.setEnabled(true);
txt.addControl(bb);
[/java]
Spatial.addControl() internally triggers control.setSpatial(this). remove bb.setSpatial(txt) and you will be fine, as this is the cause of the error.
@t0neg0d said:
[java]
bb.setSpatial(txt);
bb.setEnabled(true);
txt.addControl(bb);
[/java]
@pspeed
Here is the stack trace:
java.lang.IllegalStateException: This control has already been added to a Spatial
at com.jme3.scene.control.AbstractControl.setSpatial(AbstractControl.java:59)
at com.jme3.scene.Spatial.addControl(Spatial.java:572)
at mygame.Main.createXPlayerAvatar(Main.java:1715)
at mygame.cGameClient.handleAddPlayers(cGameClient.java:269)
at mygame.cGameClient.parseCommands(cGameClient.java:180)
at mygame.cGameClient.run(cGameClient.java:140)
Main.java:1715: line is:
[java]txt.addControl(bb);[/java]
from the code above.
@Tr3kk3r Going to give that a shot now.
@Tr3kk3r Yep… that did it for this, I am assuming that I am doing something similar with my custom controls.
Now, I just need to figure out the issue with models appearing/disappearing, and I should be good to go.
Tr3kk3r is right, you only need to addControl and removeControl a control, the javadoc says setSpatial() is an internal method no?
@t0neg0d said:
On the other hand, projected textures are still rendering as if the geometry is still there. (I turned off gravity to test this)
@normen said:
Tr3kk3r is right, you only need to addControl and removeControl a control, the javadoc says setSpatial() is an internal method no?
You sure its actually where you expect it to be? Maybe its moved by the physics? Try outputting the location (of the actual geometry).
@normen I’m sure of it, as I am using custom collision detection still. The model for the zone is loaded and never touched aside from being returned in ray casting results. Oh… and oddly enough, after re-importing the model I am using for the character, the geometry is no longer returned in picking results /boggle. Let me grab a quick video to show whats happening. brb… sorta.
@normen
@pspeed
I hope this is helpful in figuring out what the issue is…
http://youtu.be/xotCdiVj8w0
Ah. Culling/bounding boxes most probably. The bounding box is so small that the model disappears when the center gets out of the view. Do you create custom meshes()? Call mesh.updateBounds() on them.
() Edit: Or custom bounding volumes?
@normen Sorry for the delay in response, I wanted to make sure that this fixed all issues. And yes… it surely did. I have quite a bit of work to do with materials and such… everything is rendering extremely dark and the materials I apply don’t seem to be effected by light. But… I can’t thank you all enough!!! I can finally put Alpha4 to rest!
Which thing fixed it?
@pspeed updating the bounding volume fixed the rendering issue… though, I thought this was supposed to happen automatically (i.e. never, ever call things like: updateGeometricState, etc)
Yeah, it’s supposed to happen automatically. Especially since it doesn’t look like you are generating your own mesh.
…maybe a bug somewhere.
@pspeed not generating my own meshing, but I am adding bounding… should I just not do this all together?
Hmmm… here be another one that I am not sure whats going on:
[java]State was changed after rootNode.updateGeometricState() call.
Make sure you do not modify the scene from another thread!
Problem spatial name: null
at com.jme3.scene.Spatial.checkCulling(Spatial.java:241)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:768)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:786)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1109)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1160)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:266)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:149)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:182)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:223)
at java.lang.Thread.run(Thread.java:619)[/java]
I’m getting this error quite frequently, however I am not updating anything without using enque, so I am not sure whats going on here. The fact that the spatial’s name is null??! doesn’t help much either. It isn’t always null, and it is quite random which spatial it is and when it happens. I’m betting this has something to do with the bounding volumes again, I just am not sure where to start. Any help would be appreciated, of course.
This would take a lot more digging to find.
It could be modifying a spatial from a different thread without realizing it
It could also be modifying a spatial from outside of update… like in a control’s render method.
Or maybe you have a custom viewport with a node that isn’t properly managed… though I’d expect that to cause a problem all the time.
Especially in the cases where you have a name, you should track down all of the places that modify that named spatial and make sure it is always on update (either officially or from enqueue) and never anywhere else.
@t0neg0d said:
@pspeed not generating my own meshing, but I am adding bounding... should I just not do this all together?
@pspeed said:
Especially in the cases where you have a name, you should track down all of the places that modify that named spatial and make sure it is always on update (either officially or from enqueue) and never anywhere else.
@pspeed said:
What do you mean by "adding bounding"?