Starwaster / AnimatedDecouplers

Extensions of KSP's decouplers that play animations
Other
13 stars 8 forks source link

Are you sure that it works without an animation name? #1

Closed Kerbas-ad-astra closed 9 years ago

Kerbas-ad-astra commented 9 years ago

After seeing the notification that SDHI uses this module to achieve aero shielding functionality for its shroud and fairings, I've tried to apply this module to Zero-Point Inline Fairings to do the same thing, with this Module Manager patch:

@PART[0Pfairing*]:NEEDS[AnimatedDecouplers]
{
    @MODULE[ModuleDecouple],0
    {
        @name = ModuleAnimatedDecoupler
    }

    MODULE
    {
        name = ModuleCargoBay
        DeployModuleIndex = 0
        closedPosition = 0
        lookupRadius = 10
    }
}

(EDIT to improve flow: I have not met with success. When I attempt to stage it in flight, I get null reference exceptions from checkForDecoupling().)

It may be a packaging issue. In my log, I see lines like "[ModuleCargoBay]: Module ModuleAnimatedDecoupler is not an IScalarModule", but by the source code it looks like it should be, and I also get "ModuleAnimatedDecoupler: Animations not found", when it looks like that line shouldn't appear because I don't set animationName. The version number on the DLL is 1.0.5615.23976 -- shouldn't it be 1.1.something?

Kerbas-ad-astra commented 9 years ago

Just tried out 1.1.1, using a slightly modified config:

@PART[0Pfairing*]:HAS[@MODULE[ModuleDecouple]]:NEEDS[AnimatedDecouplers]
{
    @MODULE[ModuleDecouple],*
    {
        @name = ModuleAnimatedDecoupler
    }

    MODULE
    {
        name = ModuleCargoBay
        DeployModuleIndex = 0
        closedPosition = 0
        lookupRadius = 10

        nodeOuterAftID = bottom
        nodeInnerAftID = inside
        nodeOuterForeID = top04
    }
}   

Nothing popping up in the log, but still no shielding of contents (solar panels inside the fairing can open, parts in the fairing have non-zero drag vectors and CD).

Starwaster commented 9 years ago

Remove the entries for nodeInner* / nodeOuter*: I'm not 100% sure what the purpose of those are... I think it's actually for modular type cargo bays where you're assembling one long bay from multiple parts that all have the same upper/lower nodes.... looking at Squad's, only the Mk2/Mk3 cargo bays use them. The PF fairings don't use them at all and I've removed it from the SDHI Aeroshroud and it works just fine.

More importantly though, I looked at the 0P fairings and I think the problem is that it's doing its lookup from the fairing base... that's where the actual decoupler is right? So, inside ModuleCargoBay, insert this line:

lookupCenter = 0, vertical offset, 0

Replace vertical offset with a value equal to one half of the y value for the upper node. (where the nose cone attaches)

And set lookupRadius to match

For instance, if the nose cone attach node is something like 0, 5, 0, 0, 1, 0, 3 then you want

MODULE
{
    name = ModuleCargoBay
    DeployModuleIndex = 0
    closedPosition = 0
    lookupRadius = 2.5
    lookupCenter = 0, 2.5, 0
}
Kerbas-ad-astra commented 9 years ago

Your advice is spot-on. Minus nodes, plus lookupCenter does the trick (aside from the weird "bubble" effect that you noted in the ZPIF thread). Thanks!