How do I detect what part of a ray hit something?
Asked by
4 years ago Edited 4 years ago
Can you please give me an example on how to detect which part of a ray was hit? It's for a car that I'm making.
I'll only post part of the script, here is is:
02 | local TempCar = game.Workspace:WaitForChild( "TempCar" ) |
07 | TempCar.Primary.BodyThrust.location = Vector 3. new( 0 , 2 , 0.4 ) |
12 | local bottomRightRay = Ray.new(BR.Position, BR.Position + BR.CFrame.lookVector) |
13 | local hitBR, position = game.Workspace:FindPartOnRayWithWhitelist(bottomRightRay, (game.Workspace.Enviorment.Track)) |
19 | local bottomLeftRay = Ray.new(BL.Position + BR.Position + BR.CFrame.lookVector) |
20 | local hitBL, position = game.Workspace:FindPartOnRayWithWhitelist(bottomLeftRay, (game.Workspace.Enviorment.Track)) |