Vehicle won't move

I made my own chassis and it won’t work. It will aggressively clamp to the middle of the tractor and wiggle a bit before it just doesn’t move
Files:

robloxapp-20240724-1459127.wmv (1.7 MB)
The video

vehicle.rbxm (51.0 KB)
The vehicle


local backLeft = script.Parent.BackLeft
local backRight = script.Parent.BackRight

local frontLeft = script.Parent.FrontLeft
local frontRight = script.Parent.FrontRight

local steerAngle = 45
local speed = 25

seat:GetPropertyChangedSignal("Steer"):Connect(function()
	frontLeft.PartB.SteeringConstraint.TargetAngle = steerAngle * seat.Steer
	frontRight.PartB.SteeringConstraint.TargetAngle = steerAngle * - seat.Steer
end)

seat:GetPropertyChangedSignal("Throttle"):Connect(function()
	frontLeft.Part.WheelConstraint.AngularVelocity = speed * seat.Throttle
	frontRight.Part.WheelConstraint.AngularVelocity = speed * - seat.Throttle
	
	backLeft.Part.WheelConstraint.AngularVelocity = speed * seat.Throttle
	backRight.Part.WheelConstraint.AngularVelocity = speed * - seat.Throttle
end)

The Script

4 Likes

I can’t access Studio right now to check the model.

Is ANY Part Anchored in the model or models inside it? I see a wheel wiggle, but the tractor seems to stay stationary.
Are you using a Weld script? Check to see if there’s a weld to the baseplate or other anchored Part. If you use WeldConstraints then you can go to the model tab, Constraints, and click the View Welds tool.

Since this is scripting suppport please copy/paste the driving script here with 3 backticks (```) before and after it so it formats properly in your post.

If you are using HingeConstraints for the wheels make sure the ActuatorType is set to Motor and that the MotorMaxTorque is enough to move the Hinge to drive the wheel. When testing check the HingeConstraint AngularVelocity value while trying to drive. It should change to whatever your script says when WASD inputs are used.

2 Likes

Your model is filled with errors and missing files. May want to redo that …

2 Likes

your script not even adress ‘Wheel’ part

2 Likes

That was a mistake sorry about that

2 Likes

there are no errors when i run it, could you elaborate?

No, everything is welded manually.

No, like i said, all constraints.

I did that.

I’ll have to try that.

Okay, i edited the post.

2 Likes
seat:GetPropertyChangedSignal("Throttle"):Connect(function()
	frontLeft.Part.WheelConstraint.AngularVelocity = speed * seat.Throttle
	frontRight.Part.WheelConstraint.AngularVelocity = speed * - seat.Throttle
	
	backLeft.Part.WheelConstraint.AngularVelocity = speed * seat.Throttle
	backRight.Part.WheelConstraint.AngularVelocity = speed * - seat.Throttle
end

There is no Part or WheelConstraint in any of these places …

2 Likes

Do you have the HingeConstraints in the VehicleSeat? I see in the script local backLeft - script.Parent.backLeft so I’m assuming the driving script is in the VehicleSeat.

Also you also need to factor in the size of your wheels when using a vehicle like this. If you put the same AngularVelocity in the front and rear hinges the wheels will spin at the same speed, but the rear ones will travel farther because they are bigger.

You replied with “No, like I said, all constraints” which is confusing. Even if it’s all constraints having one Part anchored will anchor your tractor.

2 Likes

tractor.rbxm (51.2 KB)

Fixed some. But steering will not work very well, because Roblox didn’t gave any turning hinge and servo is meh.

2 Likes

It’s not anchoring, because deleting the body does it too.

2 Likes

My god, this works so good, your a lifesaver.

3 Likes

I just had a look at the model.
Why are you changing the AngularVelocity and LimitsEnabled of the steering hinges? Just leave them set all the time. It keeps the steering from snapping immediately to center when you stop steering.
Increase the Torque of your steering hinges, as well as the Torque of your wheel hinges. The tractor can barely drive over a 1 stud high SpawnPosition.
I also added a RodConstraint to join both the front wheels steering, like a vehicle IRL as well as a SpringConstraint to dampen the bounciness of the steering.

I also changed the MaxTorque of the steering hinges, the Friction and Density of the wheels, removed the Massless property from the wheel steering Parts, and centered the wheels hinges so that steering isn’t affected by the drag of the steering offset.

Don’t change the MotorMaxTorque to spin your wheels. Leave it constant and change your AngularVelocity.

A couple more things.
I added a crude suspension to the front axle. It’s just a HingeConstraint that allows the front axle to pivot sideways ±5°.
Cars also benefit from having the steering axis tilted slightly back so I tilted the whole front axle, PartBs, and Constraints 5 degrees back.
And I added 4 wheel drive. Since the wheel radius of the front wheels is 2/3rds of the rear ones I multiplied the AngularVelocity by 1.5 so the wheels travel the same distance.

tractor1.rbxm (53.8 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.