How do I make a ray ignore a certain character if the RaycastParams are shared between guns?

Hello.

I have a bullet system in which a new caster is created per ammo type once rather than per gun. Basically, if a gun wants to shoot, it sends out what ammo type it uses and the server takes the caster for said ammo type and fires a ray with its settings. This way there is no need to create a new caster for every gun that exists.


Problem: the bullets cannot ignore the exact player who shot it as the RaycastParams have to be created once, and cannot include a specific player since it would be shared across multiple guns. Is there any way to set it so it ignores per ray fired? I don’t want to create new RaycastParams everytime a bullet is fired.

Apologies if it’s not clear, it’s a little hard to explain.
Here is how part of the code is set up incase it helps.
image

I will try to clarify anything if need be.

I have found a solution after a little digging. For anyone who needs this and is also using the FastCast Redux module, here’s how you do this:

When the server receives a call to fire, have the model to ignore included as a variable.
image

Then, simply forward this variable over when you call FastCast itself to fire.


Inside the main FastCast module, add the variable, and add this line of code.

That’s it. This was way easier than I for some reason thought it would’ve been.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.