RaycastParams filter not working as expected (using FastCast)

Here are the params I’m using:

        local caster = fastcast.new()
        local fcBehaviour = fastcast.newBehavior()

	    local castParams = RaycastParams.new()
	    castParams.FilterDescendantsInstances = {char}
	    castParams.FilterType = Enum.RaycastFilterType.Exclude

        fcBehaviour.RaycastParams = castParams

When I do caster:Fire(tool.FirePart.Position, finalDirection, 500, fcBehaviour), the params seem to completely ignore the specified table. When the filter type is set to Exclude, nothing can be hit by the ray; when it’s set to Include everything can be hit by the ray, regardless of the actual filter table.

Not sure what’s going on - I tested the same params with a normal Raycast and it worked correctly. Does anyone have any ideas? Issue with FastCast?

3 Likes

Can’t you just use RayCast instead?

The error might be that you’re using raycast params for a fastcast.

caster:Fire specifically has a parameter for RaycastParams. Normal Raycasts won’t work for what I’m making

Why won’t normal raycasts work?

Because I want a visible projectile with travel time and gravity

Ok I figured out this problem. I had to set the behavior.AutoIgnoreContainer to false since the CosmeticBulletObject was parented to workspace and it was ignoring all workspace descendants.

But now I’m having another problem: With the blacklist for the player character, if the ray does hit the character, it will completely stop the raycast. Surely it’s just meant to completely ignore the character and continue as if it weren’t there?

Edit: Nevermind I’m just dumb - I was also doing a raycast from the camera to find the trajectory between the camera and end of the gun and I forgot to blacklist the character on that too

1 Like

You should have probably checked every single thing that could be the problem, then posting a problem in the devforum about it.

Lol ok dude thanks for the advice, it’s not that deep. I just didn’t know that property was a thing. Thought I did check everything.

1 Like

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