Programmable Block: GetArtificialGravity() ignores natural gravity

Vox Serico shared this bug 3 years ago
Reported

public Vector3D Sandbox.ModAPI.Ingame.IMyShipController.GetArtificialGravity()

Does not account for natural gravity, it always assumes full strength unlike GetTotalGravity() which does.

SE 1.197.075

Replies (2)

photo
1

I am not from Keen. You may be requested to clarify that question.

GetArtificialGravity() gets the artificial gravity

GetNaturalGravity() gets the natural gravity

photo
1

Artificial gravity is reduced by the presence of natural gravity.

GetArtificialGravity shows a strength of 100% even on the surface of a planet where artificial gravity actually is (as indicated by the hud) at 0% strength; giving a completely inaccurate reading.

photo
1

GetArtificialGravity() provides the unmodified artificial gravity vector. To obtain the reduced vector, you need to calculate it yourself. Off the top of my head it is:


Vector3D rawArtificialG = sc.GetArtificialGravity();
Vector3D actualArtificialG = rawArtificialG * (Math.Max(0, 1 - sc.GetNaturalGravity().Length() * 2 / rawArtificialG.Length());


Changing the result of GetArtificialGravity() at this point would break a lot of scripts out there that do this compensation in their own code. So I'd not recommend against doing it.

photo
photo
1

Hello, Engineers,

thanks for letting us know about this issue that you are experiencing. The issue has been reported into our internal system.

Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file