Refactor affecting Box2D collision detection (SOLVED)

After refactoring my level object into a proxy collection dynamically loaded by a manager script, my player’s collision object and the level’s collision objects do not register collisions via the system message “collision_response” generated by Box2D. This didn’t happen when the level collection was directly embedded in the main collection rather than proxied in. Do I need to register the player with the level or vice versa? Something like that?

Thanks very much for any advice.

Untitled

Update: I added the player collection to the level0 collection as a collection file (symlink?). This re-introduced collisions, but the msg.post(".","acquire_input_focus") command in the player.go’s init(self) fails to actually acquire input focus i.e. the wasd key inputs that were moving the player before no longer move the player.

As always, any input is super appreciated.

Found this stack overflow post, very related.

The stack overflow in the previous post solved my issue:

it’s not enough for the game object in the loaded collection to acquire input focus, the game object that holds the proxy component need to acquire input focus as well

Thank you very much, Mikael Säker

3 Likes

Each loaded collection creates a separate physics world. Collisions will not be detected between objects in different worlds. That’s why you have to have your player and level in the same collection.

2 Likes