AppState and ParticleEmitter

wow, sorry pspeed, i add this thread yesterday to test.

Then… how do I attach new scene and when I remove the last ?

I add MainMenu in LogoInicial and detach logoInicial in MainMenu ?

Usually if I have an app state that adds something in initialize then I’d have it remove it in cleanup. Then attaching the app state automatically calls initialize (on the render thread) and detaching it automatically calls cleanup (on the render thread) .

Also, reading the code again, you are making things very hard for yourself by dealing with the main viewport directly.

Step 1) extend SimpleApplication instead of Application and get rid of the code that you then don’t need anymore.
Step 2) instead of adding nodes directly to the main viewport just attach them to the main root node as children.

Otherwise you have to be extremely careful about the updateLogicalState, etc. calls with respect to whatever else might be modifying the scene.

You can choose not to do the above but I won’t help anymore. If you want to do things the hard way then you are on your own.

do you use multi-viewport in your app?

@Sundew said: do you use multi-viewport in your app?

No, only default in app

@pspeed said: If you want to do things the hard way then you are on your own.

Sorry, in jmonkey documentation is not complet to this subject, is only state, and not multi state.

what the best praticle to use appstate ?

@sradkiller said: No, only default in app

Sorry, in jmonkey documentation is not complet to this subject, is only state, and not multi state.

what the best praticle to use appstate ?

It’s not an app state problem. My application uses 20 or so app states. I attach them and detach them, enable/disable, etc… no issues.

Please follow the advice I gave. You are making things harder for yourself by extending Application directly and by attaching your stuff to the viewport directly instead of just using the root node already provided.

I used Application because this sample: https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/app/state/TestAppStates.java
Sorry, but you have a code to sample ?

Look at the tutorials and/or the jme3 tests projects built into the SDK.

@zarch said: Look at the tutorials and/or the jme3 tests projects built into the SDK.

Nice, good idea.
but dont use sdk direct, i put the jars directly in eclipse.
But i will try.

latter i will post the results.

Just install the SDK and then do new project->jme3 tests (or something like that).

I understand…
Then… I have to control scenes in the main application and not in AppState ?
Sample:
Application call AppState1 then call AppState2 then call AppState3.
I have do:
MainApplication Control AppState, AppState2, AppState3

@sradkiller said: I understand... Then... I have to control scenes in the main application and not in AppState ? Sample: Application call AppState1 then call AppState2 then call AppState3. I have do: MainApplication Control AppState, AppState2, AppState3

No… not a single person has said that.

I’m not sure how many different ways I can say this:

YOU HAVE TO STOP MANAGING THE VIEWPORT YOURSELF. ADD THE NODE TO THE ROOT NODE THAT IS ALREADY MANAGED BY SIMPLEAPPLICATION.

Ignore the viewport. Stop using it. Don’t use. Stop using the viewport. If you are using the viewport then do it differently.

Use the root node that is already provided. The one that SimpleApplication already gives you.

See… by extending Application instead of SimpleApplication you are doing it the HARD WAY. In this case, the WRONG WAY. You cause yourself 9000 times the trouble.

So, I will repeat:

@pspeed said: Step 1) extend SimpleApplication instead of Application and get rid of the code that you then don't need anymore. Step 2) instead of adding nodes directly to the main viewport just attach them to the main root node as children.

This is my last response to this thread unless you do the above. You can do everything the hardest way possible if you want to but that doesn’t mean we have to endure the pain with you.