#Hoverboard system help

1 messages · Page 1 of 1 (latest)

dawn dagger
#

Hi, I was wondering if anyone could help me adjust some settings on my hoverboard script and change it a bit.

So, i've copied the block of code from the video below... but am struggling to achieve a few things. I'd appreciate anything you can help with.

  • Is there a way to change it so that there is effectively less drift - at the moment the hoverboard drifts tons when I press a or d and im not sure quite how to change its drift without reducing the turning speed / top speed.
  • Is there a way to get the position to reset when I stop pressing the left or right key so that it moves straight forward? at the moment it i stop pressing all buttons it moves slightly weirdly off to the side still and I'm not sure how to change this.
  • Currently if I try to fix these things, I end up with a hoverboard that moves okay but tilts very far forward, is there a way to avoid this too and still apply the force to move forward but not tilting too far?

thank you!

#
local charater = script.Parent
local humanoid = charater:WaitForChild("Humanoid")
local connection = nil
local seat = nil
local attachment = nil
local vectorForce = nil
local orientation = nil
local alignOrientation = nil
local raycastParams = nil

local rayOffset = Vector3.new(0, -8, 0)
local rayVelocity = 0.2
local minimumThrust = 600
local thrust = 2000
local drag = 0.008
local counter = 0.004

local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(script:WaitForChild("Animation"))
animationTrack.Priority = Enum.AnimationPriority.Idle

local rayPart = Instance.new("Part")
rayPart.Anchored = true
rayPart.CanCollide = false
rayPart.CanQuery = false
rayPart.CanTouch = false
rayPart.Shape = Enum.PartType.Ball
rayPart.Size = Vector3.one
rayPart.Parent = workspace
rayPart.Transparency = 0




local function Loop(deltaTime)
    local rayTarget = seat.Position + rayOffset + seat.AssemblyLinearVelocity * rayVelocity
    local result = workspace:Raycast(seat.Position, rayTarget - seat.Position, raycastParams)
    if result == nil then
        vectorForce.Force = Vector3.new(0, minimumThrust, 0)
        rayPart.BrickColor = BrickColor.Green()
        rayPart.Position = rayTarget
    else
        local magnitude = (result.Position - rayTarget).Magnitude
        vectorForce.Force = Vector3.new(0,minimumThrust + magnitude * thrust, 0)
        rayPart.BrickColor = BrickColor.Red()
        rayPart.Position = result.Position
    end
#

other bit here```local velocity = seat.CFrame:VectorToObjectSpace(seat.AssemblyLinearVelocity)
if velocity.Magnitude > 0 then vectorForce.Force -= velocity.Unit * (drag * velocity.Magnitude ^ 2) end

orientation *= CFrame.fromOrientation(0,-seat.SteerFloat * seat.TurnSpeed * deltaTime,0)
local tiltOrientation = CFrame.fromOrientation(-seat.ThrottleFloat * seat.Torque, 0,-seat.SteerFloat * seat.Torque)
local counterX = math.clamp(-seat.AssemblyLinearVelocity.Z * counter, -seat.Torque, seat.Torque)
local counterZ = math.clamp(seat.AssemblyLinearVelocity.X * counter, -seat.Torque, seat.Torque)
local counterOrientation = CFrame.fromOrientation(counterX, 0, counterZ)
alignOrientation.CFrame = orientation * tiltOrientation * counterOrientation

end```

proven otter
#

Hey! When you are working with this, gravity plays a big part. Did you decide to use the original gravity settings or the one demonstrated in the video? If you used the setting from the video it should drift just fine. If you are using the original Roblox Studio gravity, you have to edit the thrust and weight of the hoverboard.** (In other words, try changing the weight of your hoverboard).**
For the tilt, I just divided the tilt orientation by 2 to half the amount it tilts.
example:
local tiltOrientation = CFrame.fromOrientation(-seat.ThrottleFloat * seat.Torque/2, 0, -seat.SteerFloat * seat.Torque/2)

#

I hope that helps a bit :))

#

For your second point, I'm not too sure yet... I'll have to look into that

dawn dagger
dawn dagger
#

I used the realistic setting demonstrated in the video

proven otter
#

No problem!

#

And if the weight is too much of a hassle, just change the local thrust & min thrust

sonic kayak
#

Another option is to change drag and counter

#

You can use log on counter so it does not effect top speed

#

In the video the amount of counter we applied base on speed was linear like the red line but if you change it to the blue line then it will have more counter at low speeds but less counter at high speeds