Hey everyone! I’ve been having some issues with the Multi Sphere Trace For Objects node in blueprint. I’m trying to make a grenade that gets an impulse applied to it to be “thrown” out to wherever the player is looking at. However, the Node creates two different sphere traces, which act like their own separate objects instead of just one.
Nothing I do seems to work to make only one trace happen. All I’ve found out is that the 2nd unwanted trace seems to not take the player’s Y rotation (or simply, how high they’re looking up) into account when being projected.
Here’s some images of the code being used for the grenade here, as well as a video showing off what is happening.
So this looks like an issue with Multiplayer. The reason you are likely seeing this is because your running it both on the Server and the Local Client here. If you only want this to happen on server you can add a HasAuthority node at the beginning of the Tick and only run the logic if Authority.
The issue you might run into here is the client might see things incorrect if they have a higher ping. In this case you will need to look at implementing some Client Prediction for tjos system.
Hey! First of all thank you for taking the time to respond to my question. It’s really appreciated.
Second of all, it’s only half finished my problem. I’ve put the has authority branch on when the grenade is spawned (tried putting it on the event tick in the grenade’s blueprint. It didn’t do anything.), but if the Grenade is set to spawn when the has authority node is set to true, It doesn’t spawn the physical object, nor does it travel upward in accordance to where the player is aiming. However, it does apply an impulse to the player correctly.
Alternatively, when the has authority branch is set to pass when false, the grenade spawns in and travels as normal, but when the impulse is applied to the player, they quickly rubberband back to their original position.
Here’s a picture of the new code, as well as some videos of the problem in action.
Yeah this is a pretty in depth topic about handling things like this in multiplayer. The way you have it setup there means your going to spawn multiple grenades. You want to call the Spawn on Server and the Grenade should be a replicated Actor. This will mean you spawn 1 and that one is replicated to all clients
Good news! I think this fixed the issue! I just restructured how some of the server stuff was handled in regards to the creation of grenades, and moved the adding radial force function directly to the player character’s BP, and now it works! Woohoo!