Raycast Ignores Origin GO?

Possibly a dumb question and something I could answer by experimenting, but I’m not at a computer and MUST know :slight_smile:

I’m a GameObject with a collider and I’m on the “XYZ” layer. I send out a RayCast against the XYZ layer. Do I hit myself (i.e. my own collider) on the way out, or is the first hit result from the first object on the “XYZ” layer other than me?

You hit planes with normals pointed towards you (i.e. you can’t hit the interior sides of planes, meaning from inside capsules/spheres/cubes/other convexes you’re not going to hit yourself)

Don’t you hit COLLIDERS, not meshes? So if I’m a sphere and I have a big box collider around me and a script attached to the sphere raycasts, does it hit the box collider around me on it’s way “out”? I guess the question is, can you hit a collider from the inside or only from the outside?

Right, just colliders.
Actually, rays only hit planes of colliders, and only if the ray hits the same side of the plane as the plane’s normal comes out. I’m sure there’s a word for that.
Since all of a cube’s normals point outward, you can’t hit the cube with a ray starting inside of it.

And to generalize, you can’t hit any convex collider (cube,sphere,etc) from the inside.
I haven’t tried with a concave, but I imagine you would hit any exterior surfaces the ray points at.

OK - I’ll play around tonight and see what happens. From the sounds of things though, the thing I want it to do is what it’s going to do, so… yay :slight_smile: