I am creating a projectile system where the projectile is shot locally on the client side then once the server gets notified the player shot a projectile it will spawn its own projectile on the server side and sync it with the client projectile. The client side is strictly visual and doesn’t interact with anything. I have both projectiles synced perfectly the only issue is on the client side they see two projectiles spawning. I want to just visually hide the mesh for the server projectile on the client side, so they only see their local projectile but still get the affects as the invisible server side projectile hits the target. How could I go about making it so the server projectile is only hidden to the local client who shot it?
you need to play with the actor’s relevancy settings. or you can set it as non replicated.
or you could play with the IsNetRelevantFor functions but i think you need to do that on cpp.
When the client sends an RPC to the server to create a projectile, also pass a reference to the controller of this client (Get Player Controller 0). In the projectile itself, on begin play, add a check if get player controller 0 == received during creation, then set Actor Hidd In Game = true.
Also, wouldn’t it make sense to set Owner as Get Player Controller 0 on the server side, or do you have some sneaky plan we don’t know about?
Technically, your question is confusing; you asked about Replicated Actor, so by default, if an actor is replicated, the visual “art stuff” like meshes, materials, and textures are not replicated over the network. These assets are assumed to already exist in the clients’ game’s content, not dynamically sent over the network. So you don’t need to spawn an actor on the client and server, then the system will do it by default
If you spawn an actor on the server side, it will handle the movement and collision for you, but don’t forget to enable Replicate Movement on the projectile actor
When the client shoots a projectile ( in this case more like throws a slow ball) they fire a local only projectile instantly, and calls a server function to fire a projectile. The local projectile is only visual and cant actually interact with anything. After the delay for the server shot I sync the server projectile to where the client projectile is so the hit the same place at the same time, the only is issue is the client will see both projectiles. I miswrote when I said I don’t want the mesh to replicate what I meant was I want to set the mesh visibility to not visible but only on the client side. So the client never visually sees the delayed server projectile and there visual only client side projectile will look like it is actually interacting with objects.
This was just what I came up with quickly to have non delayed replication system where the server syncs to where the client is although I am sure there are probably better built in methods for this rather than using kinematics and trying to hide a fake projectile