shadowmage45 / KerbalFoundries2

KerbalFoundries - Continued
19 stars 8 forks source link

How does scaling even work? #33

Closed Schnobs closed 6 years ago

Schnobs commented 6 years ago

Because of reasons, I want to store tracks in a KIS container for later attachment. I also want to use a scaled-down Mole track (which is huge by default). Turns out that things in KIS containers have their default mass. Also, when trying to attach it through KIS it's displayed at default scale.

I'm MM-savvy enough that I thought I could just edit the stats, so that it comes out in my desired size and mass by default... but cannot find any parameter that deals specifically with scaling. I'm also reluctant to just rescale the model like I would with any other part, because I suspect that all the colliders would need to be relocated as well.

Is there anything I can do, other than making room for the parts and transporting them in an unpacked state?

shadowmage45 commented 6 years ago

Short explanation -- nothing you can (easily) do. KIS uses the volume/etc stats from the prefab part, which will always be incorrect for scaled specific parts. It is a bit of a major oversight on the part of the developer that has gone uncorrected for years now, even after multiple reports, requests, and even offers to help .

The only thing that could be done would be to redefine the base parts' 'unscaled' setup to be at your desired KIS scale/volume. KIS would still have incorrect volume anytime the part was rescaled from this new size, but it would be correct for your use case.

As to how best to accomplish reworking the parts scale -- umm... its honestly been so long since I've played with that code, I don't know off the top of my head. Will look into it and reply later.... (not hard to do the basic model end of it, likely a single line in the config, and the stats should be auto-rescaled equivalently)

shadowmage45 commented 6 years ago

I was thinking that there should be an easy way to accomplish this, and there actually is :)

This patch should do the trick...

@PART[<partNameHere>]
{
    @MODULE[KSPWheelBase]
    {
//set this scale to whatever your chosen value is....
        %scale = 0.25
    }
}

What it does is set the starting scale for the part, the same as if you altered the scale in the editor. But this happens on the prefab during part loading, so KIS gets the pre-scaled stats when it queries for them.

It should adjust part mass, scale, and wheel stats for the new scale. Completely untested, but please let me know if it doesn't work out for you.

Schnobs commented 6 years ago

Thank you so much, my mission has just become a whole lot easier.