[TEST] Angular Momentum and Torque Generator
Mod : [TEST] Angular Momentum and Torque Generator
Author(s) : kernle
This component allows you to edit its moment of inertia (mass) and produced torque (mass*rps/tick) through composite. Good for testing.
This part can store angular momentum as well as produce torque, so it can be used to both cheat the hell out of the game and have a flywheel that's not connected to a modular engine clutch.
There is no limit to the amount of torque it can produce so... produce responsibly.
If you want to use a similar torque system in your own modded components, here it is packaged as a function:
-- torque in units of mass*rps/tick, returns: rps_out, success
function slotTorqueUpdate(index, mass, torque)
local current_rps = component.slotTorqueApplyMomentum(index, 0, 0)
if mass==0 or mass==nil then
return current_rps, false
end
return component.slotTorqueApplyMomentum(index, mass, current_rps+torque/mass)
end