Hi there,
hopefully you wonderful people can save my mood one more time!
I am not too experienced with handling AppStates, so i suspect my mistake may have to do something with wrong implementation of cleanup() or general state handling - but i don’t want to influence your opinion in advance!
So here’s the deal: My game has only 3 states: MainMenuState, ShopState and IngameState. Everything works fine until i instantiate and attach IngameState more than once within the same lifecycle of the app.
This is how it looks the first time (and how it should look):
Note that the glowing around the planet and stuff is actually a thin glowing torus with transparent material so you only see the glowing of it.
Now i detach IngameState, attach a new MainMenuState, and vice versa (fresh instance of IngameState!) and it looks like this:
Everything is screwed up somehow. Like the coordinate systems are all confused. Also note that the ship and base are brighter!
Third iteration of the process:
Materials are even brighter, models draw weird lines from their egdes to their misplaced glowing rings.
My IngameState holds the complete ingame logic and everything. It implements physics, inputs and all. I know this isn’t optimal, but i am learning
Anyway, i try to clean up properly: detach everything from rootNode, detach bulletAppState, everything. I mean it’s a fresh instance of IngameState everytime! Any ideas what could be the problem, here?
NOTE: right now i realize if i turn on the debug mode of jbullet, the wireframes of the collision shapes are in place during the first ingame run and just as misplaced as everything else when i go ingame a second time!
Sorry i don’t post code, the game is already very big and i don’t want to throw 2000 lines of code at you.