KeenSoftwareHouse / SpaceEngineers

2.93k stars 896 forks source link

Thrust Override #513

Closed x62275 closed 7 years ago

x62275 commented 8 years ago

Team,

For reference please see line 166 of: /Sources/Sandbox.Game/Game/EntityComponents/MyThrusterBlockThrustComponent.cs thrust.CurrentStrength = forceMultiplier * thrust.ThrustOverride * ResourceSink(thrustEntity).SuppliedRatioByType(thrust.FuelDefinition.Id) / thrust.ThrustForce.Length();

It is not currently possible to set the thruster's overridden output to any value. This is preventing me from completing a PID controller using the in-game scripting. The PID requires precise changes in the thruster's outputs and the increments are currently too large (a multiple of forceMultipler?) for the PID to work correctly.

malware-dev commented 8 years ago
var min = thruster.GetMininum<float>("Override");
var max = thruster.GetMaximum<float>("Override");
var factor = 0.5f;
thruster.SetValueFloat("Override", min + (max - min) * factor);

Note Mininum.

mexmer commented 8 years ago

@lord-devious GetMininum fix is already in (for some months already), so you can use GetMinimum ... i left GetMininum to not break existing scripts tho'.

malware-dev commented 8 years ago

@mexmer I thought it was - but I was lazy and couldn't be bothered to double check. This is merely copy-paste from an earlier post of mine, so I knew it'd work :wink: