How to Rig a Car

ay yo “How do u make ackerman steering”

I have a constraint chassis that uses crazyman32’s rig, and also has ackermann steering.

crazyman32 also has a twitter post about it as well.

2 Likes

Hey there, making the Ackerman Steering was pretty simple. How I personally did it was I first followed the tutorials, rigged and scripted the car. Then what I did in my script was that I use a property inside the vehicle seat (I think it was called SteerFloat). I then used this property to detect which way the vehicle was turning (-1, 1). If it was turning left, I divided the steer angle of the right (outer wheel) by 1.7. I repeated this with the right. There u have your Ackerman Steering.

1 Like

lil problem

Hi there great tutorial and well explained (apologies for bumping) but I am encountering a bug and dont know how to fix it but keep the car in its original shape

When I run the game my car glitches out and I suspect its a problem with the springs/constraints because everything else is perfect e.g when I change the freelength of the springs to 5 it stops glitching out but the original shape of the car is not retained (the suspension height increases by a lot)

Is there any way to stop the car from glitching out and to keep it in it’s original shape?

Video: car glitch bug

What are the properties of your spring? (Eg: it’s stiffness, and damping)

Also, maybe there is something wrong with your body where if your suspension height is to low, your car is colliding with some geometry, resulting in it flying in the air? Is the body of your car a union?

Hey there

What are the properties of your spring? (Eg: it’s stiffness, and damping)

Damping: 500, FreeLength: 2, MaxForce: inf, Stiffness: 10,000

Also, maybe there is something wrong with your body where if your suspension height is to low, your car is colliding with some geometry

I dont think this is the issue because I have made 2 different collision groups for the CarBody and CarWheel so wheels and body cannot collide (I have also tested this out by removing the springs and constraints to see if they collide but they dont)

Is the body of your car a union?

No, it is a group of meshparts

I have followed everything in the tutorial by @sleitnick correctly and double-checked it but the issue still arises and I am dumbfounded to what it could be directly but I know its something to do with constraints/springs

Maybe the free length is so low, that the wheels get pulled up to the platform? Did you add the platform to the collision group that doesn’t collide with the wheels?

The platform has CanCollide turned off - I will check out the Cylindrical Constraints

Hey there I found the exact issue - it was not a constraint/spring issue but instead an issue regarding the Mass part

When I change the property of Massless to true for the Mass part the rig decides to work but when the Massless property is false it glitches out? How would I solve this? (All of the parts in the car are massless btw)

Video: mass part glitch bug

Instructions unclear, rigged a car to explode.

The tutorials are pretty nice and clear, really love how its to the point.

There is a way to make a drift system in this car rig? (like jailbreak)

Hello, this is my first comment here on the devforum. Anyway, is there a way to make the chassis work without using the body(touched) function? If so, how can I accomplish that as I make my own cars and I wanna make it occur without using that function. I tried doing it on my own but it would break the script. If anyone can help that would be lovely. Thanks!

Help, i’m making a WeldConstraint trough the Body and Platform, but when i run the game the mesh falls down like it’s unanchored and the weld disappears, the parts are both unanchored.

I’m on the fourth part of the tutorial now, and I’m beginning to get pretty confused. Nothing that I’ve put into the client code seems to be working, and absolutely nothing is getting printed into the output. The local script is enabled but as I said this doesn’t really fix anything…

Also, I’m not really sure how tick and delay work for the cooldown, why I need to make the parts of the character massless after, and also why I need to keep changing network ownerships.

client

local cart = script:WaitForChild("cart")
local stop = script:WaitForChild("Stop")
local seat = cart:WaitForChild("Seat")

print("a")

local linearVelocity = cart:WaitForChild("LinearVelocity")
local Rotation = cart:WaitForChild("Torque")
local Bottom_Connection = cart:WaitForChild("Bottom")

local attFL = Bottom_Connection.FL
local attFR = Bottom_Connection.FR

local maxSteerAngle = 45
local steer = 0

local heartbeat

print("b")

function Update(dt)
	-- Steer
	local steerGoal = -seat.SteerFloat * maxSteerAngle
	steer = steer + (steerGoal - steer) * math.min(dt * seat.TurnSpeed)

	attFL.Orientation = Vector3.new(0, steer, -90)
	attFR.Orientation = Vector3.new(0, steer, -90)
	
	print("Updated")
end

function Start()
	print("Start")
	heartbeat = game:GetService("RunService").Heartbeat:Connect(Update)
end

function Stop()
	heartbeat:Disconnect()
end

Start()

print("c")

if stop.Value then Stop() return end
stop.Changed:Connect(function(shouldStop)
	if (not shouldStop) then return end
	Stop()
end)

print("d")

server

local car = script.Parent
local seat = car:WaitForChild("Body"):WaitForChild("VehicleSeat")
local body = car.Body.Body

local physicsService = game:GetService("PhysicsService")
local DefaultCollisionGroup = "Default"
local CharacterCollisionGroup = "Character"

local cooldown = 0

local occupiedPlayer
local occupiedClientScript

local carClientScript = script.CarClient

local function Cooldown(duration)
	local cooldownTag = tick()
	cooldown = cooldownTag
	delay(duration,function()
		if (cooldown == cooldownTag) then
			cooldown = 0
		end
	end)
end


local function SetCharacterCollide(character,ShouldCollide)
	local group = (ShouldCollide and DefaultCollisionGroup or CharacterCollisionGroup)
	for _,part in ipairs(character:GetDescendants()) do
		if (part:IsA("BasePart")) then
			part.Massless = not ShouldCollide
			physicsService:SetPartCollisionGroup(part, group)
		end
	end
end

local function BodyTouched(part)

	if (seat.Occupant or cooldown ~= 0) then return end

	local character = part.Parent 
	local player = game.Players:GetPlayerFromCharacter(character)
	if (not player) then return end

	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if (not humanoid) then return end

	seat:Sit(humanoid)
	occupiedPlayer = player
	SetCharacterCollide(character,false)
	car.PrimaryPart:CanSetNetworkOwnership(player)
	occupiedClientScript = carClientScript:Clone()
	occupiedClientScript.Car.Value = car
	occupiedClientScript.Parent = player.Backpack
	Cooldown(2)
end

local function OccupantChanged()
	if (seat.Occupant) then return end
	if (occupiedPlayer.Character) then
		SetCharacterCollide(occupiedPlayer.Character,true)
	end
	if (occupiedClientScript.Parent) then
		occupiedClientScript.Stop.Value = true
		local client = occupiedClientScript
		delay(3, function()
			client:Destroy()
		end)
	end
	car.PrimaryPart:SetNetworkOwnershipAuto()
	occupiedPlayer = nil
	occupiedClientScript = nil
	Cooldown(3)
end

body.Touched:Connect(BodyTouched)
seat:GetPropertyChangedSignal("Occupant"):Connect(OccupantChanged)

What exactly did you tweak? Mine is flinging around too.