AppState and Control update order

Hi, I have a few questions about how AppState and Control updates are processed. So far, I understand that AppStates are updated in the order in which they were attached to the ASM, and Controls are updated in the order in which they were attached to a Spatial. A few things I’m not sure about are:


  • Is there a way to change the order in which AppStates and Controls are updated without detaching and reattaching them?


  • If I have multiple Spatials, each with a control attached, in what order are those controls updated? Is there a way to change that order, for example to ensure that a certain Spatial’s control always updates last?


  • Are all AppStates processed separately from all the Controls (it seems like all AppStates are processed first)? Is there a way to make a particular AppState update after all Controls are updated?



    Thanks!

1 - NO.

2 - The controls are updated in a row. You have to remove/add to change the order in stake.

3 - I don’t know :smiley:

1 Like

a) no

b) depends on the structure of the scene graph

c) AppStates are processed globally before Controls (I think), you could try and use the render() method of the AppState but you should try and get your app logic working based on how things are. What exactly do you want to do?

2 Likes

Hey, thanks for the fast replies!



I’m trying to figure out how to manage my camera, and especially to ensure that the camera’s position is updated after the player’s position is updated. My first thought was to have an AppState manage the camera, but maybe that’s not a good approach…

simpleUpdate might be your solution…

1 Like

So you’re saying put the camera update code in simpleUpdate? Thanks, I’ll give that a try. :slight_smile: