x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: UE 4.19
Tags:
more ▼

asked Sep 19 '18 at 01:54 PM in Blueprint Scripting

avatar image

Shmann
13 3 7 9

(comments are locked)
10|2000 characters needed characters left

5 answers: sort voted first

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

more ▼

answered Sep 19 '18 at 02:11 PM

avatar image

Shmann
13 3 7 9

(comments are locked)
10|2000 characters needed characters left

Is your actor set to replicate movement?

more ▼

answered Sep 19 '18 at 03:25 PM

avatar image

Takao_
171 6 5 13

(comments are locked)
10|2000 characters needed characters left

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

more ▼

answered Sep 19 '18 at 05:41 PM

avatar image

Shmann
13 3 7 9

avatar image Takao_ Sep 19 '18 at 05:51 PM

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.

(comments are locked)
10|2000 characters needed characters left

(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

more ▼

answered Sep 19 '18 at 06:20 PM

avatar image

Shmann
13 3 7 9

avatar image Takao_ Sep 19 '18 at 06:43 PM

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.

(comments are locked)
10|2000 characters needed characters left

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

more ▼

answered Sep 19 '18 at 07:27 PM

avatar image

Shmann
13 3 7 9

avatar image Takao_ Sep 20 '18 at 07:42 AM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question