I didn't script this. But lets say we have a part called engine, and a part called terrain, and there's a invisible part in-between them. How do I cast the ray down through the invisible part (ignoring it) to the Terrain brick getting the distance between them.

-Down is the direction of the ray

-Start is the engine part

-ignore hoverdistance.

down = Vector3.new(0,-1,0)
start = engine.Position
ray = Ray.new(start, down*(hoverDistance*2))
object, position = workspace:FindPartOnRay(ray, veh)

EDIT: I know there's a way to use an ignore list. But how would I tell the script specifically, ignore any part not named Terrain?

4 comments

0

When it runs into an object not named "Terrain", fire another ray in the same direction until it hits terrain.

0

But what If that invisible object will always be there? And If I would fire it again how would tell the script "Didnt find Terrain"?

0

I myself would just use a bullet.

0

? What do you mean? I'm not making a gun...