I am trying to make a jetski that behaves similarly to the ones seen in Jailbreak. A key feature that makes it feel good is that the jetski tilts as you are turning, so I’m trying to recreate this.
Explorer Setup
Here’s my jetski’s mover setup and code so far:
The Stabilizer BodyGyro has the following initial properties and its purpose is to keep the jetski afloat in the water (whilst also controlling the tilt).
The BodyVelocity has the following initial properties and its purpose is to make the jetski move when its throttle is pressed.
The issue I am having is that the jetski does not turn as it moves, so it does manage to tilt but never steers around. This can be seen in the video below:
My code to control the jetski is fairly simple:
local RunService = game:GetService("RunService")
local seat = script.Parent
local massPart = script.Parent.Parent.Floater
local stabilizer = massPart.Stabilizer
local velocity = massPart.BodyVelocity
RunService.Heartbeat:Connect(function(dt)
local targetSpeed = -2 * throttleScale * seat.MaxSpeed
stabilizer.CFrame = CFrame.Angles(0, -1 * seat.Steer, 0) * CFrame.Angles(0, 0, math.rad(-15 * seat.Steer))
velocity.Velocity = massPart.CFrame.LookVector * targetSpeed -- this is the line that is not working as expected
end)
In short, I would like the jetski to rotate in the direction of steering as it is steered. I saw some posts using a BodyVelocity to achieve this which is why I used one too, but I can’t seem to get this behavior to work.
Thanks in advance