Trying to make a realistic train with good physics and a suspension, any help/ tips
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
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.
In that video do you reckon you can try and explain whats going on
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.
-- 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