SetActorLocation doesn't update Collision

Hello,

I simply use “SetActorLocation” to move my Actor to a specific Location.
The problem is: My Actors moves to the location, but the Collision is still on the previous location.

I found some workarounds in other threads, like “Set Collision off and on”, but this doesn’t work for me.
Also the problem is only on client. My Server has the correct collision position. Only the client has the wrong collision location.

Does somebody have an idea to fix the problem?

Best regards

I fixed it easily:

“SetActorLocation” was called only on server. This changes the location on server and client, but not the collision on client somehow. You need to call the “SetActorLocation” with Multicast to move the Mesh and Collision Location.

Best regards

Is your actor set to replicate movement?

That´s another way to fix the problem with “Replicate Movement”, but it shouldn´t be replicated in this way to get a better network performance. That´s why I want to set the Location one time and every gameinstance do the rest for themselves.

And btw: Calling “SetActorLocation” on Multicast is changing the collision, but only for this moment. If simulate physics is enabled the collision doesn’t update on clients. Does somebody know how to get an updated collision on clients without replicate Movement?

best regards

Replicate movement does only consume bandwith if the actor is actually moving. If he is stationary, his unchanged location does not get replicated (the same with any variable that is replicated).
What is the structur of your actor? Is the collision component the root component?
Enabling physics on a component will no activate physics on any component that is not attached to it. So if you have a character and enable physics on the mesh, then the collision component does not have physics.
If you move an actor, then the root component and every attached component gets moved, except if they simulate physics.

(I can’t answer directly on your comment, sry)

My Actor has only one static mesh and it is my root component.

Nice to know that the replicate movement only get called if the actor is actually moving, but it still need some bandwith. It shouldn’t be much with one actor, but it’s possible to get a lot of these actors in my project. That´s why I try to avoid replicate movement.

How you said: Only the called mesh has enabled physics and I only have one mesh in my actor. That’s why I´m confused that my actor doesn’t get an updated collision on clients although it has visualized physics without replicated movement.

Best regards

If your actor only consists of one mesh, what do you mean with “the collision does not move”?
Where do you call the SetActorLocation function? If you only call it on the client, but not on the server, then for the server the actor did not move and therefore it looks like the collision did not move.
Physics does not replicate. Also, UE physics engine is not deterministic! This means, that you can use physics in multiplayer only in two situations:

  1. The physics actor is not gameplay relevant (= no collision with pawns)
  2. It’s only simulated on the server and then you replicate it’s location and rotation manually.

Thanks for your answer.

I mean the following with “the collision does not move”:
First of all, I check what I hit with a linetrace.
Let’s assume the object where we are looking at is on place A.
Then I hit an event to the server and from the server to all clients (multicast) which call:
“SetActorLocation to place B” and “enable physics”.
Place B is on a mountain and the object is now directly on B. (For Server and client).
The object rolls down the mountain, because of the physics. (Rolls down on client and server)
But if I look on the object and check the hit with the linetrace, the server will generate a hit on the rolling object.
The client won’t generate a hit on the rolling object, but if I he looks directly on position B, he will generate a hit of the object although the object is rolling down the hill.

I hope that’s clarify what I mean.

And the physics actor isn’t gameplay relevant. That’s why I try to avoid replicate movement, too.

best regards

When your actor only consists of one mesh and nothing more, then the collision is definitive moving with the object, otherwise it would fall through the ground.
Your bug is in your line trace logic. Enable the debug mode for it (draw debug line trace) and see where you get a hit.