I tried changing the angular velocity (it is in CylindricalConstraint btw ) 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?
- My car speeds up really fast.
- My car keeps speed for a long time while idling and the tutorial car does not.
- 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.
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
- 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.
- 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.
- Place the Attachments like in the tutorial.
- Change Attachment names for convenience.
- Change Attachment orientation to whole numbers if not the case.
- Attachment WorldOrientation taken from the tutorial (Test the Attachment orientation of the tire. The orientation differs for some reason).
- CustomPhysicalProperties and other properties taken for the wheelmount, hub and tire from the tutorial.
Step 1
- Add the Cylindrical Constraint.
- Add variables of the tutorial.
Step 2
- Add the Spring.
- Add variables of the tutorial.
- Test the wheel (Turn the Attachment of the wheel until it is like the tutorial).
- Move the wheels to the base of the car.
Step 3
- Add Hinge Constraints to the frontwheels.
- Add variables of the tutorial.
- Move hinge towards the base unless your base is to narrow. Move it inside the wheel instead.
- Change LimitsEnabled to true and keep it on 45 unless otherwise required.
Step 4
- Test the car.
Step 5 (Optional)
- Lower TORGUE in the driver script if necessary.
- Increase motorTorque in idle in the driver script if necessary.
Not solved