Kerbal Inventory System (KIS)

Kerbal Inventory System (KIS)

1M Downloads

Show volume in the stock editor tooltip

KospY opened this issue ยท 5 comments

commented
commented

hi there, can I ask you how you check the volume of parts?

I don't see any cfgs to define the volume manually, except when you need to override it, so I assume the actual volume is calculated from the model?

edit:
I just found this,

/// <summary>Returns part's volume basing on its geometrics.</summary>

idk why it didn't show up when I searched for "volume" sorry to have bothered you

commented

Yes, the model is used to determine the volume. More specifically, the volume of the boundary box is used. Depending on the source of the part, the model can come from the prefab or from the scene. In the first case, the model adjustments, which may be done by the part modules in flight, are ignored.

commented

I had time to play around with these and found some weird results:

From some simple math I calculated the area of an orange tank (2.5 meters diameter * 7.5 meters tall)

The volume is: 36796.875 liters

However, using your code in a plugin, I get 53914 liters

Sadly, neither of those numbers are consistent with what I need :/

commented

The code calculates volume of the boundary box. Not the actual volume of the shape. If the linear dimensions are like you've mentioned (R=2.5m, H=7.5m), then the KIS volume should be 46,875 L. If you get a different answer, than either the dimensions are different, or you use the code improperly. Keep in mind that the default scale in KSP is not 1.0 (see rescaleFactor).

commented

the tank is a cylinder with the height 3 times the size of the diameter

I assumed the diameter to be 2.5 meters (no idea if that's true, that is how the tank is classified)

regardless of that, I needed the info for bouyancy stuff so I ended up just changing the content (mass) of the tank untill it was perfectly still in mid water

but thanks for the help anyways ๐Ÿ‘