Physic simulated object snaps back to old location after re-enabling Simulated physics

I’m trying to make a container of physic simulated objects. The fact is that i want this container to move at certain times but whenever I:

Set Simulated Physics = on → Set World Location of my physics capsule → Set Simulated Physics = off.

The object snaps back to the location at the time of disabling the simulation. This is definitely not the way to this and I tried different ways to approach this. I also tried making a c++ function using setWorldLocation and ETeleportType::Teleportphysics and ResetPhysics. No matter what however i approach this i can’t seem to find a proper way to fix this simple matter.

Summary: I need to manually set the location of physic objects in ANY way.

Help would be incredibly appreciated, thanks.

If you mean simulate as in the menu

You can save the simulation by pressing k during simulation. Then once you stop the current game session the physics object will remain where it was simulated.

Or you can also do it from the menu, right clicking an object and picking “Keep Simulation Changes”

If you want to keep the position inside of a normal game then you would need to save the transform of the physics objects into a save file and reload & apply this information on load.

Here you have an in-game example with a timer that simulates / turns off simulation => moves component and back again

1 start of game simulation off:

2 simulation on component falls to floor:

3 return to position from start of sim (can be different if needed)

Remember that the component has it’s position saved relative to parent, so make sure you are setting the correct coordinate space. you may need to flip back and forth between world and local space via the transform node depending on the outcome you want to achieve.

I’ve run into this issue before the snapping back usually happens because when you disable simulation, Unreal reverts the object to its last non-simulated transform. A workaround is to set the new world transform while physics simulation is still enabled, using SetWorldLocationAndRotation with ETeleportType::TeleportPhysics. After that, you can safely disable simulation and it should stay in place. Another option is to update the actor’s root component transform directly after disabling physics, instead of the physics body, so the change persists.

Curious if you’ve tried combining those approaches? Sometimes doing the move + disable within the same tick prevents the “snap back” issue.

Yes, i figured it out.
For my purpose it was better to use static mesh actor instead of Actor. That is because after simulating physics the object detaches ( didnt know about it ) and everything that happens after that is just messy and weird. By using a static mesh actor (no scene root component), I can safely move and rotate the physics simulated object without even needing to disable simulation