Train Physics and suspension help

Trying to make a realistic train with good physics and a suspension, any help/ tips

1 Like

Constraints will get you most of the hard word done, this being stuff like Rotating bogies, wheels, Roblox pgs even allows you to mess with friction of the rails or wheels which means you can even add conditions like snow or rain depreciating that friction by changing the parts custom properties. Id advise exploring and getting started with them. Vectorforce or motorise hinge constraints also are a great way to power the kit just note that pgs is alot more realistic so stuff like weight etc are important to control. Here is a good example of a train kit using all of that: https://www.youtube.com/watch?v=agIM66O1YMw

2 Likes

Hey thanks for the response, Iā€™m currently using 4 gliders on the bottom, 4 spring and prismatic joints, then to connect it to the train I use a align orientation and ball constraint, any upgrades to this setup, also I will have a look at the YouTube video now. :+1:

1 Like

In that video do you reckon you can try and explain whats going on

1 Like

A hinge constraint is being used in one axel of each bogie like the real world equivalent. This hinge constraint is set as a Motor and takes set amount of force and acceleration to power the car. The train has no gliders but uses the actual flange bit to hold itself on the rail and then the vehicles weight to keep it down. Thats a pretty advanced way to do it as any mistakes with weight or power can lead to the train derailing unceremoniously. For those not as advanced yet using gliders also works to keep train railed/ The bogies use hinge constraints to turn so it can go around curves.

3 Likes
-- Define suspension variables
local suspensionLength = 0.2 -- Length of suspension (in meters)
local springConstant = 10 -- Spring constant (in Newtons per meter)
local dampingConstant = 5 -- Damping constant (in Newtons per second)

-- Calculate the suspension force
local suspensionForce = -springConstant * (suspensionLength - wheel.Position.Y) - dampingConstant * wheel.Velocity.Y

-- Apply suspension force to the wheel
wheel.BodyForce.Y = suspensionForce