This is an example of what it does vcXXkfalLj.mp4
Please provide a sample of any code you used, or if this was made with constraints then an image of the model hierarchy (or both). It’s impossible for anyone to help if they don’t know what you need help with.
– Steer:
local goal = -seat.SteerFloat * maxSteerAngle
steer = steer + (goal - steer) * math.min(dt * seat.TurnSpeed, .5)
local radians = math.rad(90 - math.abs(steer))
local h = DistanceBetweenAxles()
local z = DistanceBetweenWheels()
local x = math.tan(radians) * h
local y = (x + z)
local outerTurnAngle = 90 - math.deg(math.atan2(y, h))
attFL.Orientation = Vector3.new(0, steer > 0 and steer or -outerTurnAngle, -90)
attFR.Orientation = Vector3.new(0, steer > 0 and outerTurnAngle or steer, -90)
-- Throttle:
local throttleGoal = seat.ThrottleFloat
throttle = throttle + (throttleGoal - throttle) * math.min(dt * seat.TurnSpeed, 1)
local torque = seat.Torque
local speed = seat.MaxSpeed * throttle
cylFL.MotorMaxTorque = torque
cylFR.MotorMaxTorque = torque
cylRL.MotorMaxTorque = torque
cylRR.MotorMaxTorque = torque
cylFL.AngularVelocity = speed
cylFR.AngularVelocity = -speed
cylFL.AngularVelocity = speed
cylRR.AngularVelocity = -speed
What are the variables seat
, maxSteerAngle
, steer
, dt
, attFR
, attFL
, cylFL
, cylFR
, cylRL
and cylRR
? It seems like all it would need is an adjustment of maxSteerAngle
(assuming it’s the maximum angle you can steer at) to about 30 - 45 degrees (possibly lower, I’m not sure).
local Players = game:GetService(“Players”)
local RunService = game:GetService(“RunService”)
local PhysicsService = game:GetService(“PhysicsService”)
local defaultCollisionGroup = “Default”
local characterCollisionGroup = “Character”
local car = script.Parent
local body = car.Body
local chassis = car.Chassis
local seat = body.VehicleSeat
local primary = car.PrimaryPart
local platform = chassis.Platform
local steer = 0
local throttle = 0
local driver = nil
local maxSteerAngle = 30
local cooldown = 0
local attFL = primary.AttachmentFL
local attFR = primary.AttachmentFR
local attRL = primary.AttachmentRL
local attRR = primary.AttachmentRR
local cylFR = primary.CylindricalFR
local cylFL = primary.CylindricalFL
local cylRR = primary.CylindricalRR
local cylRL = primary.CylindricalRL
Changing it to 10 didnt do anything it still spins.
Thanks. What is the dt
variable? I’ve got to go now but I’ll give it some thought and hopefully be back with a solution around this time tomorrow.
What is the Friction of your wheel Parts and BasePlate?
Have you tried adjusting the TurnSpeed
property of the VehicleSeat
?
no not yet ill try now bob
it just turns slower but it still drifts all the way round
So again… What are the Friction Property settings of each solid Wheel and the baseplate you are driving on.
These CustomPhysicalProperties have a lot to do with a vehicle’s ability to move properly. I usually start with a medium size car having wheels with a Friction of 2. If they seem too grippy I just reduce the value to where it works best.
Also if your VehicleSeat.Torque is set too high it’s like having a 1000 horsepower engine in a go-kart. You can’t use all the torque the engine is supplying since the wheels just spin.