Recently i have been working on a hoverboard system, but i have found a game breaking issue, the hoverboard cannot climb slops
local ignorelist = {playerchartable, currentHoverboard}
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = ignorelist
local start = currentHoverboard.Position
local direction = -currentHoverboard.CFrame.UpVector * 1000
local ray = workspace:Raycast(start, direction, rayParams)
local Y = ray.Position.Y + (ray.Normal * Vector3.new(1, 0, 1)).Magnitude + RIDE_HEIGHT
local position = Vector3.new(currentHoverboard.Position.X, Y, currentHoverboard.Position.Z) + (currentHoverboard.CFrame.RightVector * Movement.Value)
local rotate = currentHoverboard.CFrame * CFrame.Angles(Tilt.Value, Rotation.Value, 0)
currentHoverboard.BodyPosition.Position = position
currentHoverboard.BodyGyro.CFrame = rotate
You can add “BasePart.AssemblyLinearVelocity” to the raycast. Also don’t use deprecated objects, just a recommendation. Of course you should use a loop to calculate future.
Try This:
local ignorelist = {playerchartable, currentHoverboard}
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = ignorelist
local start = currentHoverboard.Position + currentHoverboard.AssemblyLinearVelocity
local direction = -currentHoverboard.CFrame.UpVector * 1000
local ray = workspace:Raycast(start, direction, rayParams)
local Y = ray.Position.Y + (ray.Normal * Vector3.new(1, 0, 1)).Magnitude + RIDE_HEIGHT
local position = Vector3.new(currentHoverboard.Position.X, Y, currentHoverboard.Position.Z) + (currentHoverboard.CFrame.RightVector * Movement.Value)
local rotate = currentHoverboard.CFrame * CFrame.Angles(Tilt.Value, Rotation.Value, 0)
currentHoverboard.BodyPosition.Position = position
currentHoverboard.BodyGyro.CFrame = rotate
Sorry for late reply, can you test this out and tell me what happens?
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = ignorelist
local start = currentHoverboard.Position
local direction = -currentHoverboard.CFrame.UpVector * 1000
local ray = workspace:Raycast(start, direction, rayParams)
if ray then
direction = -currentHoverboard.CFrame.UpVector * 1000 + Vector3.new(0,ray.Position.Y,0)
local Y = ray.Position.Y + (ray.Normal * Vector3.new(1, 0, 1)).Magnitude + RIDE_HEIGHT
end
local position = Vector3.new(currentHoverboard.Position.X, Y, currentHoverboard.Position.Z) + (currentHoverboard.CFrame.RightVector * Movement.Value)
local rotate = currentHoverboard.CFrame * CFrame.Angles(Tilt.Value, Rotation.Value, 0)
currentHoverboard.BodyPosition.Position = position
currentHoverboard.BodyGyro.CFrame = rotate
The reason may raycast doesn’t see the wedge. Also you can try to add Vector3.new(0,ray.Position.Y,0) to the start position.
Maybe redo the whole system with a raycast suspension system, it would still use built in physics and also it’s simple enough where you can use like 1 or 2 points on the hoverboard to apply the suspension force too