Raycast needs to be fixed

Requesting an update for Raycast to be optionally passive like proximity.


This means that any player standing near a bush or something passive in the background layer in their game won’t be able to raycast jump, won’t detect an enemy, ledge, or function properly for whatever task either. I wouldn’t consider this a bug, since I’m sure it was intended to not see through walls, but it could use tweaking to see through passive objects and solid objects if checkmarked.
Hopefully @grazer sees this post and can fix it.

So RayCast doesn’t trigger on an object unless it has a physics collider. If you set an object to not be solid, and not collide, then the RayCast can’t target it. Does this help, or do I misunderstand the request?

I’m saying, let’s say that you have a tree in your game or a bush or something, and it is solid or not solid, it’s just a decorational part of the level background, raycast cannot see through it. What I’m requesting is a version of raycast that works similar to proximity, that can see through any object, but only in specific directions. The problem with proximity, Is it detects both X & Y. What I like about raycast is it only detects in a certain direction, but the downside is it cannot see through anything. If anything walks or moves past raycast, even if it isn’t solid, it will still not be able to see past it. If I put an object next to a bush, even if the bush is just part of the decoration or background, the player won’t be able to see it with raycast. I’m just requesting an advanced version of raycast that can see through objects in one direction like proximity can.

Think of it like X-ray vision. Even if there are 20 blocks in front of the object I want to detect, it will still be able to see through all those blocks, to detect that object. I’m just requesting a check mark on raycast to give it X-ray vision, to see through any object.

But RayCast can see through objects if they are not solid and don’t collide. If your bush in this example is just a decoration, and is not solid or collidable, then the RayCast will see though it. Am I still not understanding the issue?

I understand the request I think (add a setting to see through any object other than the target). But you would only need it if you want to see through physics objects (either collidable or solid).

Well see the picture that I posted? The camera can’t see through the bubble left or down. If it could, X and Y would be negative or positive. The bubble is not solid and has no Collision, yet the camera cannot see through it. When a bubble floats by the camera, the negative or positive 1 for x or y become a 0, because the bubble blocks it, even though it has no Collision. But yes, I would like an option to be able to see through all other objects, so that I can see through walls and stuff. @grazer

I’ve been mulling this once for a while now trying to get enemies that have the line of sight.

Someone poke holes in this idea for me - would it work?

In terms of your scenario:

Use proximity first to determine if there is an enemy on the other side of the bush.
When YES, PointAt that specific object, record the angle of the PointAt.

Now logic that PointAt angle:

If PointAt is greater than 270 but lower than 90
Then trigger whatever you are wanting to happen had the RayCast connected

This means that the player senses all objects, but only responds to the one in the angle you wanted - in this case the one on the other side of the bush.

If you then wanted to change an objects “line of sight”, you just set the values of the greater than/less than, based on whatever. I’m (hopefully) using this to have enemies that detect in a cone based on what direction they are facing (its grid based so they only face 4 ways which is handy)