I build a simple table game with cards. The cards are moved in the same way by all players.
If i just pick up the cursor position and send the vector as a "Execute on Server " to SetActorLocation. All Clients and Server can drag and drop the BPActor around.
If i add a Snap to Grid, Vector Snapped to Grid , o a custom snap to grid function we get a Problem.
In this Case the Server can drag and drop the BPActor but all clients can see the BPActor on the right place but when clicking on the BPActor the Click MouseEvent don’t get a TouchedComponet o the component under the BPActor.
We tested a lot and got finally a solution, it seems that the SetActorLocation function has a bug when you input integer Vectors.
- the snap to grid function results in a newlocation like 200/200/300 o 0/0/0
- any vector we send to SetActorLocation newlocation which is like “Integer” 0/0/0 or 30/20/50 results in the same error.
So we tried to put float values in the SetActorLocation newlocation like 10.1234567/10.1234567/30.1299999 and finely everything worked again.
So to use the SnaptoGrid function we simply add after the function a Vector+Vector with a random float value.
So here the Blueprint Screenshot of the version working without grid on Lisening Server
Blueprint Actor ( this is just the part we need for explication )
- Set cursor visible. So the Hit cursor function can be tracked while moving an while looking around with yaw and pan.
- Loop timeline for Get Hit Result, set new location and send it to the PlayerCharacterBP for a Server RPC.
3 This BPActor is set to replicate, always relevant, replicate movement and net load client.
In The Player-Character BP we do a simple call to SetActorLocation and add to smooth the movement a Ease.
Here the BPActor not working: Important the NewActorLocation is 400/400/0 0 in a 400 grid all numbers like
To make this Work we add a Vector+Vector with a lot of numbers behind the . like 1.23412341234123412341234
It is enough to set just one number of the vector with a real long float to make it Work.
So this is solfed but this seems to be a bug in the UnrealEngine Function.