I’m following sleitnick’s tutorial, “How to Rig a Car”. I would post there, but it’s been dead for 3 years and the last guy who asked for help there got no response.
I’m using a different car model for this tutorial, and I’ve had to modify some of the steps along the way. This has gone perfectly so far, but now I’m stuck on how to move forward.
In the first part of the tutorial, sleitnick discusses using cylinder parts to handle the physics of the wheels instead of the wheel meshes themselves, as the cylinders will allow the car to drive more smoothly. He uses commands to resize and position the cylinder exactly where the wheels are.
When I did this for my wheels, however, the cylinder was rotated 90 degrees and the X and Z dimensions were flipped. No problem, I thought, I can just adjust the cylinder to properly fit the wheel. Which is exactly what I did, and I continued with the tutorial.
In part two of the tutorial, sleitnick goes over rigging the car with CylinderContraints and SpringContraints. I’m following along perfectly, until the point where I have to adjust the inclination angle of the CylinderContraints. Upon adjusting, I learn that each CylinderContraint is rotated 90 degrees on another axis. No problem, I thought, I can simply rotate the CylinderContraint back 90 degrees to fix the issue. Which is exactly what I did, and I continued with the tutorial.
[Nothing bad happened on the third part]
In part four of the tutorial, after sleitnick discussed the server-side script in part three, he now goes over creating the LocalScript to handle the vehicle’s controls. Here is the part of the script responsible for handling that:
local function Update(dt)
--steering stuff
local steerGoal = (seat.SteerFloat * maxSteerAngle)
steer = steer + (steerGoal - steer) * math.min(dt*seat.TurnSpeed,1) --this just makes the wheels turn smoothly
attFL.Orientation = Vector3.new(0,steer,-90)
attFR.Orientation = Vector3.new(0,steer,-90)
--throttle stuff
local throttle = seat.ThrottleFloat
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
cylRL.AngularVelocity = speed
cylRR.AngularVelocity = -speed
end
It is here where another issue occurs. When testing my vehicle, my front tires are now stuck facing sideways. No problem, I thought, I’ll just subtract 90 degrees from the steerGoal to counter this. Which is exactly what I did, and I continued with the tutorial.
…Is what I would say if another problem didn’t present itself immediately. The car is able to move forward and backward now, but I noticed that the front wheels were turning opposite to my inputs (pressing left would make the wheels turn right). No problem, I thought, I’ll just make the steer property negative in the Vector3.new. This fixed the inverted steering… but now the car doesn’t drive.
I am genuinely stumped at this point. I’ve linked a .rbxl file that contains the vehicle and script (located in ServerScriptStorage) if you wanted to mess around with it.
golfcart.rbxl (112.0 KB)