I know that when calling a server RPC from a client, in order the prevent cheating I should never use a client set variable in the server RPC without checking it.
In this example I do a linetrace on the client, if I hit an object I send a reference of that object to the server.
I would then like the SERVER to do a distance check between the actor and the object. My thinking is that even if the client spoofs which object it sends, the server will be able to check the distance between it’s authoritative version of the client and the object and determine if the interaction was plausible. However, I don’t want the client to be able to pass himself as a parameter in addition to the object to interact with. I would like to server to determine who sent the RPC and check the distance itself with only a reference to the object from the client.
My fear is the client might be able to send a spoofed object and the ID of a different client through the RPC and the server would be checking the object against the wrong player.
So simply put, is there a way for the server to determine which actor sent an RPC by itself. I googled for about 2 hours with no luck, maybe I am missing something obvious.
Here is the code the client is calling
UFUNCTION(Server, WithValidation, BlueprintCallable, Unreliable)
void ServerInteract(AActor* HitActor);
The client is passing a reference to the hit actor here.