Today I have been trying to produce a ‘tank chassis’ car such as the cars seen in RoStock Racing and Just Daytona where instead of the wheels rotating by the front axle, the left and right wheels rotate at different speeds to induce rotation of the chassis.
I have to an extent made the car that moves and rotates** but for some reason it will not rotate under acceleration and deceleration, only when the car is at its top speed or when it is stationary, it also will not rotate while the car is rotating in another direction. I have actually no clue what could be wrong with it but I am trying to make a racing game with prototype cars however when I tried to use the system of a front axle moving to get the car to rotate the two front wheels would often bug out and lose traction with the road surface on acceleration and the steering would constantly wobble the wheels.
I had a look on devhub and nobody has had too much of a similar issue as to provide a solution to this from what I have seen, I have tried messing with the friction of the vehicle and messing with the torque but I am not sure of what else to do.
local seat = script.Parent.VehicleSeat
local fLeft = script.Parent.FrontLeft
local fRight = script.Parent.FrontRight
local bLeft = script.Parent.BackLeft
local bRight = script.Parent.BackRight
local speed = 60
local turnForce = 5
local function wheelUpdate()
local leftSpeed = speed * seat.Throttle + turnForce * seat.Steer
local rightSpeed = speed * seat.Throttle - turnForce * seat.Steer
fLeft.Wheel.WheelConstraint.AngularVelocity = leftSpeed
fRight.Wheel.WheelConstraint.AngularVelocity = -rightSpeed
bLeft.Wheel.WheelConstraint.AngularVelocity = leftSpeed
bRight.Wheel.WheelConstraint.AngularVelocity = -rightSpeed
print(leftSpeed)
end
seat:GetPropertyChangedSignal('Steer'):Connect(wheelUpdate)
seat:GetPropertyChangedSignal('Throttle'):Connect(wheelUpdate)
For some reason I am unable to upload a screen recording of the car handling but hopefully the symptoms of the script is good enough, will upload a video when roblox decides to behave ig
The physical properties of the wheels
Motor properties of hinge constraints
Maybe try to change someway these calculation and see how that affects the car? It helped me, but in some other scenarios, I actually have no idea how to fix this, so don’t take my words seriously
There are a lot of posts about making cars with steering like a real car. It’s pretty effective. You could try searching suspension cars or car constraint steering. I’ve posted on quite a few so maybe use @Scottifly in the advanced search filters. HingeConstraints have Properties that can make the hinge less ‘bouncy’ but I find in fast moving vehicles or with rougher surfaces they just don’t stay in place. I use a Motor at the center of the steering with an Attachment offset to act as my steering box, then use the Steer inputs to rotate the Motor. Have a look at my Suspension Test game on my profile to see how effective they are.
Fine tuning a car is tricky the first few times you do it. It’s mostly like real life vehicles.
Mass of the car’s chassis and wheels affect traction and stability
MotorMaxAcceleration is something people keep at too high a number causing the wheels to accelerate too quick and lose traction. I generally set it at about 10 and see how the car handles then tune it from there.
A car without suspension generally doesn’t do well with traction. Each wheel has a force on it so if one loses contact with the ground it throws handling out the window.
As to your issue, the script is doing the wheelUpdate function when either steering or throttle is changed.
It sounds like your friction is set too high, or the vehicle’s mass is too high causing the steering to be off.
Also, not checking for vehicle speed is going to throw a lot of issues at you. With your system at low speed your turn rate might be ok, but at high speed the car will likely steer too suddenly.
Thanks mate, I’ve not had the greatest experiences with steering constraints but ill check out your posts and give it a shot while I can. I appreciate the feedback with tuning and everything i’ve never really gotten my head around that and I’ll also try and add some sort of understeer for when the car reaches higher speeds as i have seen the sudden rotation as an issue when the car reaches speeds above 110. I’ll get back to you on this post but I appreciate the help
I use a script that takes the car’s speed while the car is turning and decreases the turn angle.
Give Constraints a try and if you’d like me to look at the model in a PM then I’d be glad to help.
I can also share the turn angle script calculation.