SetActorTransform node won't change the location of actors that simulate physics (???)

So I am basically trying to change the transform and the velocity of a rolling ball. The ball is supposed to teleport away as soon as it touches a specific overlap/trigger box but it doesn’t work as expected. The velocity of the ball changes but the transform of the ball stays the same. Since it’s a rolling ball, it is of course simulating physics (important to note; the velocity change is executed AFTER the “SetActorTransform” node, so I know for a fact that the blueprint graph actually fully executes). Could the fact that it’s simulating physics have anything to do with this? I read in some old forum posts, where people used older versions of UE4, that the “SetActorTransform/Location/Rotation” nodes had no effect on actors that simulated physics. Is that still the case?

I recorded a video showcasing the issue: (the white wall has NO COLLISION, so the ball isn’t bouncing back due to collision. I checked. It’s just not shown in the video)

So my questions are basically:

  1. What the hell is actually causing this?
  2. What’s a good way to fix it?

STRANGE. I know that objects stop replicating when there is physics and desync starts. you have to run physics on server then update to clients but that has nothing to do with your problem from what I can see that is single player your doing. you could stop simulating physics during the teleport and then start it back up how you want it to go thru. if It doesn’t work cheat lol. thats what ive learned.

I’ve kind of had that idea as well. I have a bit of trouble doing it in practice though. I want to disable “Simulate physics” on all actor components when an actor overlaps, teleport the actor and then enable “Simulate physics” again. The problem though is that I don’t want to enable physics simulation for ALL components after it teleports. I only want to enable physics simulation on the components in the actor that were previously enabled (before the teleport).

Also, what happens if you enable/disable “Simulate physics” on a component that doesn’t have that option?

As you see, set physics on will detach component from scene root, so that you set actor’s location not change component’s position(StaticMeshComponent’s position)

So if someone is still looking for an answer to this, when simulating physics the component that simulates the physics will hold the position that you want to teleport. E.G. For me I had a UStaticMeshComponent that was simulating physics. Instead of calling SetActorTransform you will need to call UStaticMeshComponent::SetWorldTransform, which has the same parameters as SetActorTransform. This will give you the desired behaviour.

1 Like