I’m making a racing game and most of my testers say the Roblox physics make it hard. My goal is to make it somewhat like Mario kart’s physics, but I don’t know where to start. Also, sometimes it the wheels act weird when teleporting like in this video:
How the cars move:
coroutine.wrap(function()
while true do
task.wait()
if info.BoostTime > 0 then
seat.Throttle = 1
end
if base.Orientation.Z >= 10 then
bodyGyro2.MaxTorque = Vector3.new(50000, 0, 50000)
elseif base.Orientation.X >= 5 then
bodyGyro2.MaxTorque = Vector3.new(50000, 0, 50000)
elseif base.Orientation.Z <= -60 then
bodyGyro2.MaxTorque = Vector3.new(50000, 0, 50000)
else
bodyGyro2.MaxTorque = Vector3.new(0, 0, 0)
end
if info.Stunned == false then
frontLeft.PartB2.SteeringConstraint.TargetAngle = steerAngle * seat.Steer * 2 + seat.Throttle
frontRight.PartA2.SteeringConstraint.TargetAngle = steerAngle * seat.Steer * 2 + seat.Throttle
frontLeft.Wheel.WheelConstraint.AngularVelocity = info.Speed * seat.Throttle
frontRight.Wheel.WheelConstraint.AngularVelocity = info.Speed * -seat.Throttle
BackLeft.Wheel.WheelConstraint.AngularVelocity = info.Speed * seat.Throttle
BackRight.Wheel.WheelConstraint.AngularVelocity = info.Speed * -seat.Throttle
else
frontLeft.Wheel.WheelConstraint.AngularVelocity = 0
frontRight.Wheel.WheelConstraint.AngularVelocity = 0
BackLeft.Wheel.WheelConstraint.AngularVelocity = 0
BackRight.Wheel.WheelConstraint.AngularVelocity = 0
end
bodyGyro.MaxTorque = Vector3.new(7000000, 0, 0)
if base.Orientation.Z > 10 then
bodyGyro.P = 25000
bodyGyro.D = 1000
bodyGyro.MaxTorque = Vector3.new(5000000, 0, 0)
bodyGyro.CFrame = CFrame.new(base.Position, base.Position + base.CFrame.LookVector)
else
bodyGyro.MaxTorque = Vector3.new(0, 0, 0)
bodyGyro.P = 0
bodyGyro.CFrame = CFrame.new(base.Position, base.Position + Vector3.new(0, 0, 1))
end
end
end)()