Reset transform of all physics objects

Hey all, I’m using the ResetLevel node in the GameMode base class to reset a level when ever a round ends, but I’m trying to figure a way to reset all physics objects back to their starting transform…

At the moment I’m getting all static mesh actors in the level during BeginPlay in the GameMode blueprint, and adding a reference to the actor to a map along with the initial transform as the value

After calling the ResetLevel node, I then use the map to iterate through all the static mesh actor references and set their transform back to the original stored transform in the map

Despite it successfully storing all the right actors I’m after it resetting and their transforms, all the static mesh actors fail to teleport to their original transform…

What other ways can I approach this problem?

You could give each object a unique starting point (on the physics object blueprint), then create a custom event that resets the object to that starting point.

then, on the GameMode blueprint, find all your physics objects and call the “reset” event that you created

if you dont want to do it that way, you could try destroying all the old objects and spawning new ones

This may end up having to be the solution - to create a custom blueprint for which the physics objects will be children of, if there is no way to do it with out of the box physics objects (e.g. a cube with simulation enabled) and the custom game mode

So ended up figuring out the sequence I had in the GameMode blueprint was actually fine - I was just forgetting to check “Static Mesh Replicate Movement” checkbox, so the server just wasn’t telling the clients about the new transform after resetting…

I’ve also created the custom blueprint inheriting from the StaticMeshActor base and overridden the OnReset function (and remembered to set replicates movement), so the GameMode code is doing the reset for any static meshes not using the custom blueprint, while the custom blueprint handles the OnReset for itself (for any other custom behaviors the static meshes may need)