This Surface Normal code work, but it unstable and I need help to fix it

local raycastResult = workspace:Raycast(HRP.Position,, -20, 0))
if raycastResult then
	local surfaceNormal = raycastResult.Normal
	local p1 = HRP.CFrame.LookVector:Cross(surfaceNormal)
	local p2 = surfaceNormal:Cross(p1)		
	bodyGyro.CFrame = CFrame.fromMatrix(HRP.Position, p1, surfaceNormal) --* CFrame.Angles(0, math.rad(steer), 0)

This code make the horse shaking really hard on the normal base part, and it shaking a lot

Try using the third :Raycast parameter: RaycastParams. Give the raycast a blacklist of the horse’s model and it will ignore all of the parts inside of the horse.

1 Like