I’m trying to make a game with three pawns: two players (server and client) and one pawn (sphere) without a controller. Either player could possess the other pawn as long as it overlapped, and if the sphere was already possessed, the other player would be in spectator mode. I used a blueprint interface for communication so that the sphere checks if there’s already a player in it and decides what to do, but the output from the interface event is always authority, not remote, even when it’s the client’s turn. I’m a noob.
its likely the collision (overlap) only happens on server which is usually a good thing as the server should handle possession too
I reworked my code and the client doesn’t possess anything, even giving an error regarding the player controller’s cast. Maybe that’s the problem? Here’s the code:
It worked for me to make the server event in the player and call it with the cast in the sphere, I just don’t know if this is the best way.
But I have another question: does this possessed sphere only move if the keyboard event is linked to one of these server-side functions? The sphere only moves this way…
the better way is just to do it all on server. The RPC fails because the client doesnt ‘Own"‘ the actor. but if all the logic is entirely server then the client doesnt need to do anything except move into the collision.
that depends on your setup, CMC has client side prediction but if the Sphere doesnt use that you may need a different method
I’m using Add Force and Add Impulse, so will I need an RPC every time I call these functions on the client? That’s what I’m doing.
physics is complicated but it cant be done client side as it will desync from server.
the only way is to apply the physics on server and replicate the movement back to the client. (this may be janky though)
but all collision should also only happen on server so you dont need an RPC exactly. if say it was a a bullet you may RPC the bullet but the server would apply damage/impulse