I want to make a raycast projecting from the camera, but with a radius (CapsuleCast), so that there’s a lot of leeway for looking and still triggering what I need to trigger.
I basically want to detect if something is visible on the screen, but I want to not trigger it if it’s behind a wall, which is why I’m using casts.
I’ve looked around, and read about CapsuleCast on the Manual, but for some reason I can’t get it working, even after watching multiple tutorials.
This is what I got so far:
if (Physics.CapsuleCast (transform.position, transform.position.x, transform.forward, Mathf.Infinity, out hit)) {
}
I converted it from a normal Raycast, so some stuff might be there that is not supposed to. As I said, I read the manual, but I just don’t understand some parts, so I just kept them the same as for the raycast.
First thing is, I’m not sure how to specify the second transform position.
And I’m generally not sure how to set the whole thing up. I want it to have one at the camera’s position, and the other away from the camera (so it would be laying down and not standing).
Also, I don’t want to use a LayerMask, so I don’t know if I can just not include it without any errors.