Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a Ray ignore objects that aren't named Terrain?

Asked by 9 years ago

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?

0
When it runs into an object not named "Terrain", fire another ray in the same direction until it hits terrain. Tkdriverx 514 — 9y
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"? Orlando777 315 — 9y
0
I myself would just use a bullet. Perci1 4988 — 9y
0
? What do you mean? I'm not making a gun... Orlando777 315 — 9y

Answer this question