I’m planning to do a summer update for my ski resort game. But since I need bikes, I firstly tried to search on toolbox, but all of the models were for city games. I tried adapting the balance for my mountain bike but I wasnt happy with the result.
I tried using body gyro but it wasnt working well with steep terrains, then I tried with vector forces but I just failed on trying to balance.
anyway here’s the function I used for bodyGyro
local bodyGyro = Instance.new("BodyGyro")
local force = 800
bodyGyro.P = force
bodyGyro.MaxTorque = Vector3.new(1000,0,force)
bodyGyro.D = 500
--of course I have set a parent for it
function updGyro()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {bike}
local ray = workspace:Raycast(seat.Position, Vector3.new(0, -20, 0),params)
if ray then
local normal = ray.Normal
--print(normal)
local p1 = seat.CFrame.LookVector:Cross(normal)
bodyGyro.CFrame = CFrame.fromMatrix(Vector3.new(0, 0, 0), p1, normal) * CFrame.Angles(0,0,math.rad(bike.HandHinge.TargetAngle*30))
end
end
--this function runs in a loop
Also is it possible to get something that also uses centrifugal force? (ex. for curves)
here’s an example of what I want to get: (of course I’ll never get such a good bike)