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"

Set Actor Location on client / replication

Hey there, I have a blueprint actor and set replicate and replicate movement to true but when I use "Set Actor Location" with the client the object only changes location in the clients window. At the server window the object remains at it's original position. Any idea what might went wrong?

Product Version: Not Selected
Tags:
more ▼

asked Aug 04 '14 at 10:43 AM in Blueprint Scripting

avatar image

NoMonkey89
139 9 14 21

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Everything that is replicated and what you want on every client/server, needs to be set by the server. So if you let the client Set an Actor location you need to call a custom Replicated event that is "RunOnServer" and got an Input of the VectorLocation and the Actor you want to set. So the Blue Custom Event Call node of your new replicated event will get the Vektor and the Actor as input and the red one that will be run on the server will have these two as outputs to actually set the actors postion.

Here is a picture:

alt text

For the actor you can use the one you want to change (i used the actor i run it on (self) for this) and the Vector in the blue node can be set to what ever is on your mind. I left it empty at this point.

These two variables will be passed to the Red node that is run on the server and, like you can see on the screen, will change its location.

(: Hope that works for you mate

more ▼

answered Aug 04 '14 at 10:53 AM

avatar image

eXi
6.8k 333 185 470

avatar image NoMonkey89 Aug 04 '14 at 10:59 AM

It does! Thank you for the explanation :)

avatar image User1000 Mar 31 '16 at 10:26 AM

this is good, but dosnt work well with physical objects, like my physics thruster driven space ship, help?

avatar image eXi Mar 31 '16 at 01:53 PM

Well, Physics are always kinda special. I learned (although i don't actually know if that's still the case), that Physics should always be calculated on the Server and THEN send back to the Clients. The Clients themselves should NOT calculate physics. So the Client only has the Thruster animation, but doesn't actually move the ship.

The only downside to this is the Player who wants to move the Ship, since he would need to wait for the Server to give him the correct position. So you would want to apply physics on the Server and the LOCAL Player. But every other Client will only see the position of the Player updating.

So every player calculates physics for his own ship. The Server ALSO calculates the physics for that ship and the replication of the position takes care of correcting things that might went wrong on the Client side. And all other clients that only have a replicated copy of the ship, they only apply the location they get.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I was running into a similar issue, even using a run-on-server RPC function. The problem in my case turned out to be the "net load on client" flag under replication on the actor itself; it should be OFF.

I think what's going on here is net load on client basically tells connecting clients to load all objects in the level during client connection from the client's hard drive; I think it does this to save bandwidth by not having to send all the information about the level. So if your actor is already in the level (which mine was) and you are trying to move it after the fact during level or game mode BeginPlay or similar, you want the client to get information about the actor directly from the server when loading the map, instead of loading the initial start locations from the map it already has (which is normally safe for objects that won't need to move, hence the default to "net load on client" being sane)

I also checked "replicate movement" but i'm not sure if that was necessary. If your actor exists in the level itself at load, I think this should fix your issue.

more ▼

answered Sep 03 '16 at 12:43 AM

avatar image

dave_sullivan
70 4 7 13

avatar image Podgyhodgy Mar 06 '19 at 12:33 PM

Thank you very much Dave Sullivan. That is exactly what I needed. I was buggering about trying to 'force network update' and all sorts of stuff - and all I needed was to untick a box or two.
I shall mark this in my diary and call it 'Dave Sullivan day' and I will drink to your health.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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