TheOpenSpaceProgram / osp-magnum

A spaceship game
https://www.openspaceprogram.org/
MIT License
216 stars 32 forks source link

Static Truss Analysis for Vehicles #292

Open Capital-Asterisk opened 5 months ago

Capital-Asterisk commented 5 months ago

For someone with more of a mechanical engineering background.

Rockets aren't suppose to be wobble (if someone want's to make a wobbly rocket, add a spring joint part!). Each separate moving part (referred to as Weld in code) can be perfectly rigid, but run a little truss simulation in the background for internal tension and stresses.

Inputs from the physics engine can be fed in per-frame: fictitious centripetal forces, rocket thrust, collisions.

Parts can have stress/tension/shear limits for connections (I don't have a mechanical background lol). Radial connections can have strength determined by contact area.

This sounds like it may make the game too complex, but the intention is to make vehicle structure behave intuitively or as it would in real life. A tiny part sticking out without much structural support should be allowed to be knocked off with a strong whack. Truss structures arranged in triangles are strong. A toddler can understand if a tower of building blocks is stable or not.

Implementation details: