Can you cast ray inside of object?

I don’t really know how to explain this with words but here is an image:

If you mean for the ray to not intersect with the part(s), you could add it to the ignore/black list.
RaycastFilterType (roblox.com)
RaycastParams (roblox.com)

No, the ray is going through the part then hitting the side of it.

I don’t think you get what I mean.
The image shows a ray going through a part then hitting the side of it.

I’m assuming the point you’re interested in is the “end of ray” part… what you would probably want to do is something along the lines of putting the ray direction and origin vectors into the object space of the part and then doing some trig with the part’s sizes and finally put back into world space again. Probably a better way of doing it but that’s what I thought of first.

I do not understand, this is confusing. Mind showing me what you mean with an image or something ?

forgot to note again. ray_origin is the first ray’s origin.

1 Like

You are talking about whitelisting an object, this is not what I am asking.
As I’ve stated, I am not talking about whitelist, I am talking about a raycast that goes through an object, then it hits the side of the same object internally.

Besides, there is literally a whitelist table you can add objects to instead.

I showed you an image how to get the “end of ray” position in this image

the first raycast which hits a part if it does, shoot a whitelist raycast with whitelist table like this {HitPartOfTheFirstRaycast} and you do the origin, look like this

local origin = startofray_Origin + (startofray_LookVector * 100)
local look = startofray_LookVector * -100
1 Like

I still don’t think you are understanding.
I want an inverted object basically, where the raycast goes inside then hits the side.

1 Like

What he’s saying is that, to get the “inverse” raycast operation on an object, unless it’s a complex concave shape, can be calculated by simply casting from the opposite direction from the other side of the object whitelisting only the object once it’s been “targeted” in order to avoid unwanted detections, as shown in this badly drawn picture:

This should give you the same result as what you want

2 Likes

Oh, I see.
Thanks for the help!

1 Like