Destroy Game Piece When Falling of Map [SYNTH-216]#1404
Conversation
PepperLola
left a comment
There was a problem hiding this comment.
Wouldn't robots respawning with the gamepiece they're holding be dependent on both the update order of their respective position trackers and whether the root node of the robot was above or below the gamepiece?
Also, gamepiece body IDs never get removed from the field's mechanism's nodeToBody map, meaning anything that would need to reference that later would end up with a bad body ID. It's also used a lot in multiplayer code, which means you could probably end up with ghost gamepieces. I think we should go back over a lot the spawning/configuring/destroying stuff we have and make sure it would all work in multiplayer if we end up deciding to pursue that again.
| const zones = World.sceneRenderer.filterSceneObjects( | ||
| (x): x is ScoringZoneSceneObject => x instanceof ScoringZoneSceneObject | ||
| ) | ||
| zones.forEach(zone => ScoringZoneSceneObject.removeGamepiece(zone, bodyId)) |
There was a problem hiding this comment.
removeGamepiece currently only actually removes a gamepiece from the scoring zone if !shouldPointsAccumulate meaning otherwise the gamepiece body ID would stay referenced even after it's been removed from the scene.
There isn't really any easy and clean way to destroy game pieces right now, sync with multiplayer. Removing it from the nodeToBody map causes errors. Rather than doing a scuffed implementation, I am going to hold off until PR #1393 (Game piece asset support) gets merged, which will make this easy and clean to implement. |
Task
SYNTH-216
Symptom
Currently game pieces can be thrown out of the field and they will fall forever (which also breaks the camera if you are focused on a field).
Solution
Destroy game pieces when their y level is below a certain amount.
Verification
Before merging, ensure the following criteria are met: