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:

--//Getting 4 Corners Of Car
local TempCar = game.Workspace:WaitForChild("TempCar")
local BR = TempCar.BR	--This is referencing to four corners Bottom Right, Bottom Left, Top Right, and Top left.
local BL = TempCar.BL
--local TL = 
--local TR = 
TempCar.Primary.BodyThrust.location = Vector3.new(0,2,0.4)

--//Raycasts

--BottomRightRay
local bottomRightRay = Ray.new(BR.Position, BR.Position + BR.CFrame.lookVector)
local hitBR, position = game.Workspace:FindPartOnRayWithWhitelist(bottomRightRay, (game.Workspace.Enviorment.Track))
if hitBR then
	-- Just some notes, I haven't finished the script yet because I decided to work on another part.
end

--BottomLeftRay
local bottomLeftRay = Ray.new(BL.Position + BR.Position + BR.CFrame.lookVector)
local hitBL, position = game.Workspace:FindPartOnRayWithWhitelist(bottomLeftRay, (game.Workspace.Enviorment.Track))
if hitBL then
	
end
--TopRightRay (These are just for sorting my stuff out)

--TopLeftRay

3 comments

0

Please help

0

can you post the script

0

ye