Issue Respawning Actors in the Correct Order


Author- Ethan Ortega

Problem:  In level 2 there is a cooking station puzzle that spawns different actors when you hit a selected button. When the puzzle was completed I was attempting to save the actors in the correct order so that when the player loaded back into the game, the puzzle would be solved in the right order. The issue I was running into was the actors were spawning in the wrong order with the smallest actor always spawning on the bottom. I believe this was due to when the actors were spawning back in, they were colliding with one another and pushing the smallest one to the bottom messing up the order. 

Solution: Through debugging I realized that saving the actor's position was not the way to go about this. The actor had both a default scene root and a static mesh. since the static mesh was simulating physics and would be the one dropping into the scene I needed to save its location. When loading them back into the game I could use the static meshes location to spawn the actor back in. Since all the actors were no longer spawning at the same location, there was no weird collision between them forcing the smaller one to fall below the others. the image below demonstrates how I got the first actor in the world that was spawned in by the puzzle of its particular class and got its static meshes, world transform. I was allowed to save that into my transform array and reload the actors back on begin play.

The video above is the demonstration of me completing the puzzle then reloading back in with my save and the actors being in the correct spots.

Leave a comment

Log in with itch.io to leave a comment.