More Realistic Handling for a Car ( Not an A-Chassis )

I have made a car for a racing game and want it to handle similar to cars in Roblox F1 games like Formula Apex or RFA.

‘Normal’ cars can make tighter turns when they are going slower. My car does this but not to the right extent. In games like Formula Apex, if you are going too fast on a tight corner, you will hit the wall. My car’s turn rate is very similar while going fast and slow.

Basically the problem is I want the cars to now always be going to top speed, but have lots of mobility while going slow like in Formula Apex

if you want to try the cars, use these links:
Formula Apex: [BETA] Formula Apex - Roblox
My game (go to the race tab and press quick play): LO - Test Place - Roblox

Script:

--SERVICES
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

--Constants
local Player = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Chassis

local PlayerGui = Player:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
--Variables
local CurrentCameraCFrame

local RetireDown = false
local RetireTime = 0

local Sinx = 0
local character = script.Parent
local Controls = nil

local Seat 
local Active = false

character.Humanoid.Seated:Connect(function(active, SeatPart)
	if Controls ~= nil then
		Controls:Disconnect()
		Controls = nil
	end
	
	if SeatPart == nil or SeatPart.Name ~= "VehicleSeat" then 
		Camera.CameraType = Enum.CameraType.Custom
		Active = false
		return
	else
		
		Camera.CameraType = Enum.CameraType.Scriptable

		Seat = SeatPart
		Active = true

		--ENGINE
		local Car = SeatPart.Parent
		Chassis = Car.Chassis
		CurrentCameraCFrame = Chassis.Parent.CameraPart

		local CBL = Car.WheelBL.CylindricalConstraint
		local CBR = Car.WheelBR.CylindricalConstraint
		local CFR = Car.WheelFR.CylindricalConstraint
		local CFL = Car.WheelFL.CylindricalConstraint
		local AFL = Chassis.AttachmentFL
		local AFR = Chassis.AttachmentFR

		local SW = Car.SWheel


		local MaxAngularVelocity = SeatPart.MaxSpeed / (SeatPart.Parent.WheelBR.Size.Y/2)

		Controls = SeatPart.Changed:Connect(function(Property)
			if Property == "SteerFloat" then
				--STEERING
				local orientation = Vector3.new(0, (-SeatPart.SteerFloat  * SeatPart.TurnSpeed)+90, -90)
				print(SeatPart.Velocity.magnitude)
				

				TweenService:Create(AFL,TweenInfo.new(0.3),{Orientation = orientation}):Play()
				TweenService:Create(AFR,TweenInfo.new(0.3),{Orientation = orientation}):Play()

				SW.HingeConstraint.TargetAngle = 45 * -SeatPart.SteerFloat
			elseif Property == "ThrottleFloat" then
				--FORWARD + REVERSE
				local Torque = math.abs(SeatPart.ThrottleFloat) * SeatPart.Torque * 1000
				local AngularV = math.sign(SeatPart.ThrottleFloat) * MaxAngularVelocity

				if Torque == 0 then Torque = 2000 end

				CBL.MotorMaxTorque = Torque
				CBR.MotorMaxTorque = Torque
				CFL.MotorMaxTorque = Torque
				CFR.MotorMaxTorque = Torque

				CBL.AngularVelocity = AngularV
				CBR.AngularVelocity = AngularV
			end
		end)
	end
end)


RunService.RenderStepped:Connect(function(deltaTime)
	if Active and Seat then
		workspace.CurrentCamera.CFrame = CurrentCameraCFrame.CFrame
		workspace.CurrentCamera.FieldOfView = 70 + Seat.Velocity.magnitude * 0.1 + (math.sin(Sinx)*0.1)
	end
end)

Hey,
You can divide the maximum turning radius by the speed at which you are moving, e.g. add 2 variables 1 is the speed to which the turning angle should fall and the second is the minimum value in % as long as the car can turn the wheels

I’ll try this today, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.