I’m working on putting actual units on spring constraints like lbs/in and kg/mm and I got a good start thanks to this devforum post and how A-Chassis calculates weight.
I made this model with a 5 stud ruler and a fixed spring right next to it, the ruler represents 50 inches since I’m following 1 stud = 10-inch on this one.
Spring model.rbxm (6.8 KB)
The model is a total of 6 studs in height if you include the 0.5-stud cubes that hold the spring constraint and I made the following script for the spring to put real units on the spring’s stiffness.
local simulatorModel = script.Parent.SpringSimulator local weightBrick = simulatorModel.WeightBrick --[[Variables]]-- local simulatorGravity = 35 local brickWeight = 5 --lbs --Brick weightBrick.Size = Vector3.new(0.5,0.5,0.5) --Spring local springRate = 5 --lbs/in local springDamping = 1 local springLength = 5 --[[calculations & stuff]]-- local densityCalc = (brickWeight/2.205/8)/(weightBrick.Size.x*weightBrick.Size.y*weightBrick.Size.z*1000/61024)/1000 weightBrick.CustomPhysicalProperties = PhysicalProperties.new(densityCalc,0,0,0,0) local springConstraint = simulatorModel.Spring springConstraint.Stiffness = springRate*1.25 springConstraint.Damping = springDamping springConstraint.FreeLength = springLength local bForce = Instance.new('BodyForce', weightBrick) bForce.Name = 'Gravity Force' bForce.Force = Vector3.new(0, weightBrick:GetMass()*(workspace.Gravity-simulatorGravity), 0)
From the script, we got a 5 lbs 0.5 stud brick and a spring rate of 5 lbs/in. When you run the model, nothing went wrong, but as soon as you resize the brick to whatever, that’s when you’ll see the problem. The size of the brick can affect the weight even without the current weight calculation as the one in the script. I already have an idea of how to fix it, but I just don’t know how to implement it. I know that raycasting would be the best choice for putting real units to springs and stuff, but I would also like to see if it’s possible to use real units on spring constraints.