How do I accuratley recreate Slot Car (Scalextric) physics in Roblox Studio?

I’m currently working on a project that is a game inspired by the Slot Car toys, like Scalextric and Carrera. I’m able to get the car to stay fixed on the track while also sliding around the curves, but the physics aren’t too accurate for what I’m trying to recreate.

What’s supposed to happen is that when the car derails after going round a bend too fast, it’s meant to tumble off the track, like a real Scalextric car, example seen below:

but that doesn’t happen on my version and instead it leaves the track in a boring manner.

As for how the car is constructed, let me give a little rundown:

The car is built of a rectangular body, with axels that has wheels connected to them.
car built 1

Under the car’s body, it has a cylindrical swivel part, which has a black brush that connects the car to the track’s slot, when the car goes around a bend, the swivvel will cause the car to slide and recoil back.


It also has two gliders (the spheres) attached to the brush so that it can stay on the track and not jerk or jump while driving. (inspired by Roblox Trains)

I also have a Down VectorForce on the car that toggles every 1 second, so the car is pinned on the track.
car gliders

And similar to real Scalextric Slot Cars, there is a weight at the back which is meant for the car tumbling when it drives around a bend too fast. The back weight of the car is how the car crashes.
car weight

I don’t think the weight is actually doing anything to achieve the effect I want, I tried to mess with the car’s CustomPhysicsalProperties, and edit the positions of the gliders so I could get a more accurate result, but they seem to not really do very much.

Also I tried googling the problem and searching for on the Developer Forums, but whenever I search up “Roblox Slot Cars” I get results for something completely different.

You may want to look at some of the information in posts about trains or carts.

Does the swivel actually move, or are it and the pin welded solid to the car chassis? If they are welded the car will still pivot around the pin while it’s in the slot. One of the problems Roblox Physics has is with small thin parts like the pin. When moving at faster speeds they’ll just pass right through other Parts because of the way physics is calculated. You may want to try a wider pin and just a slightly wider slot, about .005 studs thinner so it’s not dragging both sides of the slot. Making the pin deeper would help too. You could hide this by putting a Cylinder SpecialMesh inside the pin and modifying the Scale to make the pin visually thinner. Then do the same thing with the slot by putting a BlockMesh in the Parts on either side with the scale set higher than 1 to make the slot seem narrower.

Try making your wheel Density around 1-2, which will give them some down force to create traction. It’ll also lower the cars center of gravity. Friction will also help with traction.

I’d remove the weight Part for initial testing.

Hello, thanks for your response and suggesting a possible solution.

I’ve tried to adjust the car and the track based on your suggestion to fixing the problem, unfortunatley it didn’t seem to fix the problem and it didn’t get the desired physics results. It’s actually performing WORSE than the unedited cars, because the older cars try to make an effort in going around the bend, while the newer one straight up ignores them. At some point I increased the thickness of the Car’s brush but it made it stuck when going around the bends


As seen in the video, I cycle between the old and new car, and the old car performs much better than the new one

By the way, I spaced out the slit in the track, it didn’t make that much of a difference either.
image

I’m not sure if increasing the density of the wheels helped or made it worse.

Maybe I did something wrong, I might try again later if that’s the case.

I actually saw this post yesterday but had other things to do. Sorry.

Anyway, let’s consider the following:
Scalectrix cars are small. Very small.
Therefore, being small, they have very little mass, and thus a lower weight.

Newton’s second law of motion describes:
Force = Mass * Acceleration
In your case, you’d want to increase the acceleration of your cars coming off the track, so rearranging it gives us Acceleration = Force / Mass. So, your options are:

  1. Increase the force
  2. Decrease the mass

You can’t increase the force because the cars would go too fast, so your only option is to decrease the mass. This makes sense - as mentioned before, Scalectrix cars are small and lightweight.

That’s why increasing the density of the wheels made it worse - because you made the car heavier, leading to less acceleration, leading to a less realistic derailing. So my advice will be to make the density lower on the body and wheels. Increase the friction on the wheels (a LOT - I’m fairly certain scalectrix cars have rubber tires, even) to compensate for this, as they won’t have as much grip now.

(PS. It’s spelt Scalectrix, as it’s a portmanteu of ‘Scale’ and 'Electri(cs)x`.)

1 Like

Could you please specify how much the weight and friction should be on the Car’s body and wheels?

This is what I set the CustomPhysicalProperties to be on the Car’s body:
image

And the wheels look like this:
image

When I try testing it out, the car decides to do the wheelies as soon as it starts moving, and it’s very uncontrollable.
wheeeeleies
(in the second gif i disabled the counterweight at the back and it still didn’t fix the problem)
wheeeeleies
Also, if you’re wondering if there is a script error, here’s what the script of the Car’s movement looks like (it is the only script for the car’s movement)

local slotCar = script.Parent

local backWheelRight = slotCar:WaitForChild("SlotCarWheelBackRight")
local backWheelLeft = slotCar:WaitForChild("SlotCarWheelBackLeft")

local hingeConstraintRight = backWheelRight:FindFirstChildOfClass("HingeConstraint")
local hingeConstraintLeft = backWheelLeft:FindFirstChildOfClass("HingeConstraint")

local velocity = 60

game.ReplicatedStorage.Car1SetSpeed.OnServerEvent:Connect(function(player, speed)
	print(speed)
	slotCar:SetAttribute("velocity", speed)
	velocity = slotCar:GetAttribute("velocity")
end)

game.ReplicatedStorage.Car1Move.OnServerEvent:Connect(function()
	hingeConstraintRight.AngularVelocity = -velocity
	hingeConstraintRight.ActuatorType = Enum.ActuatorType.Motor
	hingeConstraintLeft.AngularVelocity = velocity
	hingeConstraintLeft.ActuatorType = Enum.ActuatorType.Motor
end)

game.ReplicatedStorage.Car1Stop.OnServerEvent:Connect(function()
	slotCar:SetAttribute("velocity", 0)
	hingeConstraintRight.AngularVelocity = -slotCar:GetAttribute("velocity")
	hingeConstraintRight.ActuatorType = Enum.ActuatorType.None
	hingeConstraintLeft.AngularVelocity = slotCar:GetAttribute("velocity")
	hingeConstraintLeft.ActuatorType = Enum.ActuatorType.None
end)

while true do
	--print("This is some dummy text.")
	slotCar.SlotCarBody.VectorForce.Enabled = not slotCar.SlotCarBody.VectorForce.Enabled
	task.wait(1)
end
1 Like

this is actually realistic to what slot cars do when you start them too quickly - you need to slowly adjust the throttle at the start to avoid them from going too fast and doing exactly that

in general, though, you should also lower the torque and speed of the wheels and lower the car’s centre of mass as much as possible (also make the wheelbase longer)

Are the CustomPhysicalProperties of the car and it’s body I’ve set what you’ve had in mind when coming up with your suggestion?

you’re gonna need to experiment with that because i don’t really know exactly how much they should be

1 Like

I tried to tweak around with the way the car is built and it’s physical properties and I also tried modifying the track to be thicker and it’s still not that good.

I was thinking maybe if i completely redo the way the car is built.

I was thinking what if instead of making the car get pinned to the track by the brush part, I instead use hooks (that also act like spawners) that are already pinned to the track and they have a block attached to them, which acts like a hitbox to the car (so that it’s appearence can be swapped out for different car models skins etc) and it also has wheels so it can move forward, and making the construction such that it tips over when going round a bend too fast.
image

Does this sound like a logical solution that can fix the performance of the cars and give a more realistic gameplay experience?

There’s a Property of HingeConstraints called MotorMaxAcceleration.
It acts like a real electric motor, so if it’s really high it’ll go from AngularVelocity 0 to it’s maximum almost instantly.
Try setting it to something like 10 to see what happens. It’ll probably accelerate very slowly. Keep experimenting with it to see where it works best for your cars.