Do you mean removing the weld constraints that connects the seat to the wheelmounts or are you talking about welds that connect the wheelmount to the wheel itself, because I do not understand why weld constraints are an issue with the steering? Also I do not have the wheelmount connected to the wheel with a weld. Could you explain what you mean in more details ?
As I understood the model the wheelmount is the part that is supposed to move so it can steer.
If it’s welded to the seat it won’t rotate around the HingeConstraint.
The HingeConstraint needs to be attached to the solid frame of the car with an Attachment and to the wheelmount with another Attachment. It can be the only way the wheel/axle assembly is connected since any other welds between it and the frame won’t allow it to move at all.
I understand what you mean now. I found out I had the weld constraint on the front instead of the back side. I laughed really hard when I discoverd it lol. Unfortunately I still have an issue with my car while driving it. We are getting closer.
As you can see at the start. The wheel gets into an odd position, but after a few sec it goes to the normal position. When I accelerate the car it still moves weird, but I can finally turn the wheels! Do you know what could cause this weird behavour? I thought it would be gone when rotating should be possible.
For some reason one of the two wheels does not rotate really far until I accelerate the car.
I have also turned CanColide off on the center piece to ensure it has enough space, but it did not help as you can see below, so I will turn it back on. This also happens when CanColide is true.
For some reason my wheel goes off it’s place and moves down. I am really confused now.
In version 3 I rotated the left car to the same direction as the middle and right car, so I do not confused with the weld constraints again.
myCar.rbxl (113.8 KB) V3
Looks like the spring settings are different from left to right since the right wheel is still up in the air and the left is way down.
The right spring or PrismaticConstraint should be able to move the right wheel away from the height of the axle assembly.
The left wheel being so far down may also indicate it’s touching the body Parts. Try turning right to see what happens to the wheels then. If the Right wheel drops down then it’s probably hitting the frame.
There is a setting in Studio (same place as the ShowDecompositionGeometry) that says “Show Collisions”. This setting shows a red sphere where moving Parts contact other Parts. Try turning it on so you can see where the wheels are touching other items.
I have checked the spring settings as you asked. They have the same settings.
The right wheel also does the same like the left wheel when turning right, so both wheels have the same problem.
I would like to try the Show Collisions setting to find out if it is indeed hitting the frame, but I am not able to find it. I have tried to search for it in the searchbar, but it did not show up.
Is the Show Collisions setting removed or am I looking at the wrong place?
Oh sorry, it’s “Are Contact Points Shown”.
When I turn without accelerating.
When I turn with accelerating.
When I go into the seat I get sometimes strange behaviour like this even with CanColide on. Sometimes the car turns upside down.
For some reason with CanColide on the car will still jump a bit when I go into the seat. Also trying to turn to the left is very strange. The steering still is not what it should be like the car of the building-carkit-1.
Well… I guess I did not cancolide enough of the part… I guess I have to figure out what to do with this.
Why not leave the axle part(s) where they are and put the HingeConstraint Attachment in the very center of the wheel, so there is the least amount of deflection since the wheel is kind of ball shaped anyway?
Also it would make it so the axles don’t have to move around into the other parts.
I tried putting the HingeConstraint Attachments into the center of the wheel, but it reduces the shart turn, so I have moved it to a more appealing spot. The right green ball are the HingeConstraint Attachments.
I have found invisible corners next to the tire, so I have set these parts to CanColide off as a temporary fix. I think I will negate these parts later.
This video shows the steering right now. It is getting better, but I still have some jumps.
I wanted to start solving my tire, but I wanted to test whether the tire was the problem first by checking if the rim could roll properly, because it is round on the outside. Then this happened.
Is this the reason why the car jumps sometimes or is the wheel really the issue?
I have created a better looking wheel in blender, but it still has some of the notches like before.
What do you think is the best option right now?
This is the new version now.
myCar.rbxl (117.9 KB) V4
Here’s a common mistake. You’ve got the wheel torque set to 100 as a base and 10,000 in the script which is fine, but you’ve got the MotorMaxAngularAcceleration set to infinite. This means the wheel goes instantly from 0 rpm to max rpm and causes your torque issue.
I set it to 100 and it seems better, you can play around with it.
Then I set each wheel’s Friction value to 1.0 to get rid of the sliding. You can set it up to max of 2.
The car moves alot smoother now! I have changed the MotorMaxAngularAcceleration to 100 instead of inf and the AngularVelocity to 1.5.
But I still have an issue when I am getting into the seat. It happens alot actually. The wheel and wheel mount reverses for some reason or the car flips over. I do not know what causes this problem.
New version with these changes implemented.
myCar.rbxl (118.0 KB) V5
I have found something really helpful. I found out that the car in the tutorial has better friction, because of a simple setting. Apperently the hub, tire and the wheelmount of the car has CustomPhysicalProperties enabled. I changed the Density and the Friction of the tire to 2 like the car of the building-carkit-1 tutorial.
Wheel
Tire
Wheelmount
Because of this, I replaced AngularVelocity and MotorMaxAngularAcceleration to it’s original values, so I am able to go full speed when I turn.
Khanovich also said this to me:
So I created a cylinder with the same size as the tire of my car and replaced the position value to the tire’s position, so it is in the perfect spot. Then I welded the cylinder to the tire and set CanColide to false on the meshpart. The cylinder is going to be invisible, so it looks like my tire is moving the car instead of the cylinder.
Wheel with visible cylinder.
Wheel with invisible cylinder. You don’t notice anything now!
Look how smooth the steering is now!. I was not able to find the reason why my car goes faster than the car in the tutorial. I have been looking at the vehicle seat torque, CylindricalConstraint, HingeConstraint and the driver script, but it looks the same.
Now I have a few things left to do. The random flip or reversing wheels issue when I am taking a seat and the speed of my car. As you can see the speed greatly reduces on the tutorial car when you idle. My car keeps at the same speed for a long time.
myCar.rbxl (118.0 KB) V6
Your speed is dependent on the HingeConstraint’s angular velocity and the tire size. Bigger tires spun at the same rpm will travel further so the vehicle goes faster.
Nice catch on the Physical Properties of the wheel(s).
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