Now, I am trying to understand how to use
BulletAppState physics in my game.
I have a
SimpleApplication instance and some
AppStates inside, that helps me switch between scenes. When I say scene I mean new class extends
BaseAppState I created. I want to add physics to some of this scenes. For example, I want to have physics space in game scenes and don’t want to have it in menu scenes. I am using
BulletAppState for it.
The first I don’t understand, is why do they use
AppState for physics adding. As I understand,
AppStates using for work with scenes.
The main question is how I can add physics to some of my scenes(for every scene I create a new class extends
BaseAppState) and work with them. I don’t understand how I must work with
BulletAppState. I must create one
BulletAppState instance in main class and add objects of all scenes to it’s physics space or I must create a new field(instance of
BulletAppState) inside each of my classes extends of
The first way I think won’t work because all objects from all scenes will be in one physics space. As I understand, there will be collisions between objects that not really in one scene.
The second way seems more good, but I don’t understand how to work with different
BulletAppState's instances attached to the one
stateManager. How I can get
BulletAppState of concrete scene I need, if I will have many
BulletAppStates attached to the one
For example, now I want to write method in main class that will enable physics debug mode on all bullet app states I have. I want go through all bullet app states and call
setDebugEnabled method. But I can’t get exactly
BulletAppStates attached to
stateManager because of it’s method
getStates returns all
AppStates and some of them is
BulletAppStates describing physics but some of them is
BaseAppStates describing game scenes . If I calls
getState method it returns the first state that is instance of the specified class but how about others and how do I know bulletAppState of what scene will be the first?
Please, advice me the best way working with