Lego car steering is weird (building-carkit-1)

I tried changing the angular velocity (it is in CylindricalConstraint btw :yum:) and changing the tire size, but it did nothing. My tire is actually smaller than the car in the tutorial, so it should have been slower. Can you take a look at the car when you have the time? I am not able to figure it out.

Not on my computer, but doesn’t the driving script set the AngularVelocity?
I thought I saw an “average of all 4 wheels” calculation somewhere in there when I was looking at it.

Yes it does.

it would make sense that it depends on the size of the wheel, because of the RotVelocity, but I am not able to see a difference. Even changing the wheelsize to 3 like the tutorial car does not help.

I have also tried changing the values in the script based on my wheelsize (every number divide by 3 times 2.85, because of the wheelsize). I thought that would compensate my wheelsize, but that also does not work.

-- TUNING VALUES
----------------------------------------
-- Factor of torque applied to get the wheels spinning
-- Larger number generally means faster acceleration
local TORQUE = 9500

-- Factor of torque applied to change the wheel direction
-- Larger number generally means faster braking
local BRAKING_TORQUE = 7600

-- Max angle the wheels will reach when turning
-- Higher number means sharper turning, but too high means the wheels might hit the car base
local MAX_TURN_ANGLE = 28.5

-- Car max speed
local MAX_SPEED = 133
----------------------------------------
-- Idling
if math.abs(throttle) < 0.1 then
	motorTorque = 95
-- Accelerating
elseif math.abs(throttle * currentVel) > 0 then
    -- Reduce torque with speed (if torque was constant, there would be a jerk reaching the target velocity)
    -- This also produces a reduction in speed when turning
    local r = math.abs(currentVel) / MAX_SPEED
    -- Torque should be more sensitive to input at low throttle than high, so square the "throttle" value
    motorTorque = math.exp( - 2.85 * r * r ) * TORQUE * throttle * throttle
    targetVel = math.sign(throttle) * 9500  -- Arbitrary large number

-- Braking
else
    motorTorque = BRAKING_TORQUE * throttle * throttle
end

I have no idea what I could do to fix this.

I have been trying to figure out what is going on for a while now, but unfortunately I still have not been able to figure it out. Are there other people who might know what’s going on?

  1. My car speeds up really fast.
  2. My car keeps speed for a long time while idling and the tutorial car does not.
  3. The front wheelmounts reverse sometimes entering the seat.

1 set the TORQUE lower, this is your ‘acceleration’ value.
2 set your “motorTorque = 95” to a higher value at idle. If Torques are set closer to zero there is no friction so it won’t slow ‘normally’.
3 set the UpperAngle and LowerAngle limits (LimitsEnabled) to keep the steering Servo motor from flipping around itself past the limits you set using the steering angles.

1 Like

It worked! Thank you very much dude! You are a legend! I have lowered the TORGUE value and increased the motorTorgue in idle. I just compared the speed of the tutorial car and mine and tried to get it as close as possible. It got me some awesome results.

It also worked to set a limit for the HingeConstraint servo. The wheelmounts are not able te reverse anymore.

the only thing I can’t get away is the movement at the beginning when I sit in the car seat, but that is just a minor bug. If someone knows the reason and would like to explain why this happens, that would be great, because I don’t understand why this happens.

myCar.rbxl (118.1 KB) V7

Thank you @Scottifly for all the help you gave me. These are the steps I did to get my result. If you have any questions or issues with these steps. Send me a message and I would love to get the steps more clear for you.

Preperation

  1. Build your car. If your parts are models, weld the parts inside and use Weld Constraints to connect other models or welded parts to it.
  2. Place the wheel in the starting position like in the tutorial. If you use a MeshPart as wheel, make it CanColide false and place a invisible wheel inside welded.
  3. Place the Attachments like in the tutorial.
  4. Change Attachment names for convenience.
  5. Change Attachment orientation to whole numbers if not the case.
  6. Attachment WorldOrientation taken from the tutorial (Test the Attachment orientation of the tire. The orientation differs for some reason).
  7. CustomPhysicalProperties and other properties taken for the wheelmount, hub and tire from the tutorial.

Step 1

  1. Add the Cylindrical Constraint.
  2. Add variables of the tutorial.

Step 2

  1. Add the Spring.
  2. Add variables of the tutorial.
  3. Test the wheel (Turn the Attachment of the wheel until it is like the tutorial).
  4. Move the wheels to the base of the car.

Step 3

  1. Add Hinge Constraints to the frontwheels.
  2. Add variables of the tutorial.
  3. Move hinge towards the base unless your base is to narrow. Move it inside the wheel instead.
  4. Change LimitsEnabled to true and keep it on 45 unless otherwise required.

Step 4

  1. Test the car.

Step 5 (Optional)

  1. Lower TORGUE in the driver script if necessary.
  2. Increase motorTorque in idle in the driver script if necessary.

Not solved