Can you make Mouse.Target go through objects?

As the title says, can you do that? For example, there is a small cube inside a big cube, and the big cube has its Transparency to 1, what I want is the Mouse prints the small cube.

1 Like

Use mouse.TargetFilter to filter out parts.

2 Likes

For Mouse, your only option is Mouse.TargetFilter. Whatever part you set that to has it and its descendants ignored. So to use that, you’ll have to put all invisible/ignored parts into one folder and set that folder to be ignored. Alternatively, you can set the target filter to whatever part Target finds if the Target is transparent, but that only works with one layer.

Alternatively, you can use a custom Raycast and use RayParams to blacklist an array or CollisionGroup of parts.

Lastly, there is a third option that’s much easier. If you set a part’s CanCollide property to false, a new property will appear called “CanQuery”. If you set that to false as well, it won’t be picked up by any spacial queries, including raycasts. But the obvious issue is that CanCollide must be disabled for this to work.

1 Like