I am using a BodyGyro to apply torque to my raycast-suspension chassis however when the car is oriented vertically by about 45 degrees one side of the chassis sinks.
📔 Notes:
**1 • ** I use Hooke's law to calculate suspension force.
**2 • **I pass the compression value to the springs offset table and then calculate torque geometrically using:
local Springs =
{
{P = Vector3.new(-0.5, -0.5, 0.5)}, -- Front-right spring.
{P = Vector3.new(-0.5, -0.5, -0.5)}, -- Front-left spring.
{P = Vector3.new(0.5, -0.5, 0.5)}, -- Rear-right spring.
{P = Vector3.new(0.5, -0.5, -0.5)} -- Rear-left spring.
}
local X: number = (self.Height + self.Tires.Radius) - RayResult.Distance -- Spring constant.
-- X is the spring's compression
local Pitch: number = math.atan((Springs[1].X + Springs[2].X - Springs[3].X - Springs[4].X) / SizeZ)
local Roll: number = math.atan((Springs[2].X + Springs[4].X - Springs[1].X - Springs[3].X) / SizeX)
**3 • **I currently have each spring's offset, compression, acceleration, length and travel.
⁉️ Help:
If you could send me a better physical / geometrical torque formula it would be greatly appreciated.
🌟 Bonus:
Weight transfer only if possible.