How to use Motor6D to achieve vehicle steering

Hello, I was wondering how to use a Motor6D to make steering for my vehicle system, I tried but it just doesn’t move even if it’s updated by the Heartbeat event, I don’t know what I’m doing wrong

This is what creates the Motor6D

local motor = Instance.new("Motor6D", steerMotors)
			
motor.Part0 = steer
motor.Part1 = rotor
			
motor.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), math.rad(90))
motor.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), math.rad(90))
			
if not (position == "F") then
	steer:Destroy()
	motor:Destroy()
end

This is how it looks in-game

And this line of code updates its DesiredAngle property

for _, m: Motor6D in pairs(currentVehicle.SteerMotors:GetChildren()) do
	m.DesiredAngle = -(vehicleSettings.SteerAngle * vehicleSteering)
end

But the result it’s just the Steer part rotating instead of the Rotor part as the Rotor part has a CylindricalConstraint that attaches it to the wheel, so if it rotates, the entire wheel it’s supposed to rotate

I don’t use Rigs, so I only have used Motor6Ds with a script and a VehicleSeat.
This script is placed inside the Part containing the Motor6D. None of the Parts are Anchored.
I’ve used it in many of my vehicles.
I usually use one Motor6D in the center with an offset Attachment connected with RodConstraints to both front wheel axle Parts so you can create an Ackerman steering system.

local steer = script.Parent.Motor
local seat = script.Parent.Parent.however many parents get you to.VehicleSeat
steer.DesiredAngle = 0

seat.Changed:connect(function()
	if seat.Steer == nil then return end
	if seat.Steer == 0 then
		steer.DesiredAngle = 0
	elseif seat.Steer == 1 then
		steer.DesiredAngle = 0.4
	elseif seat.Steer == -1 then
		steer.DesiredAngle = -0.4
	end
end)
3 Likes

Do you have custom scripted suspenson applied?

1 Like

Nope, just Constraints for the suspension, Prismatic, Hinge, & Spring.
I don’t like Hinges or Cylindrical Constraints set to Servo for steering because they seem to be a little too springy in the Hinge rotation no matter what Force you put into them, especially if you are using them in a vehicle that is going to be bouncing over rough terrain.

You can try them out here: Tracked vehicle, suspension and racing tests. - Roblox

1 Like