Jump to content

Let Hollow Parts Protect Contents from Drag


Recommended Posts

Some of the adapters and nose cones look to be hollow, so players put batteries and small tanks in there,  but KSP considers the small parts to be surface-attached to the outside of a part in the stack, so exposes them to the full airflow.

The method of figuring what parts are enclosed in cargo bays is detailed enough to protect parts inside the hollows of the protecting parts, while leaving parts on their outer surface exposed to the airflow.   We can apply it to whichever parts we choose with a module-manager patch:

Spoiler

@PART[Mk1FuselageStructural] {
//Mk1FuselageStructural Structural Fuselage
	MODULE,0 {
	// a module of type IScalarModule to report the cargo bay open/closed state
		name = ModuleColorChanger
		toggleInEditor = false
		toggleInFlight = false
	}
	%MODULE[ModuleCargoBay] {
		DeployModuleIndex = 0
		lookupRadius = 1.0
		nodeOuterForeID = top
		nodeOuterAftID = bottom
		nodeInnerForeID = top
		nodeInnerAftID = bottom
	}
}
@PART[adapterSmallMini*|noseCone|pointyNoseCone*|standardNoseCone] {
//adaptersmallminishort FL-A5 adapter
//adapterSmallMiniTall FL-A10 Adapter
//noseCone AerodynamicNoseCone
//pointyNoseConeA Advanced Nose Cone
//pointyNoseConeB Advanced Nose Cone
//standardNoseCone Small Nose Cone
	MODULE,0 {
		name = ModuleColorChanger
		toggleInEditor = false
		toggleInFlight = false
	}
	%MODULE[ModuleCargoBay] {
		DeployModuleIndex = 0
		lookupCenter = 0, 0.1, 0
		lookupRadius = 0.5
	}
}
@PART[largeAdapter|largeAdapter2|rocketNoseCone] {
//largeAdapter Rokomax Brand Adapter
//largeAdapter2 Rokomax Brand Adapter O2
//rocketNoseCone Protective Rocket Nose Cone
	MODULE,0 {
		name = ModuleColorChanger
		toggleInEditor = false
		toggleInFlight = false
	}
	%MODULE[ModuleCargoBay] {
		DeployModuleIndex = 0
		lookupCenter = 0, 0.2, 0
		lookupRadius = 1.0
	}
}
@PART[airplaneTail*|Size3to2Adapter] {
//airplaneTail Tail Connector
//airplaneTailB Tail Connector
//Size3to2Adapter ADTP-2-3
	MODULE,0 {
		name = ModuleColorChanger
		toggleInEditor = false
		toggleInFlight = false
	}
	%MODULE[ModuleCargoBay] {
		DeployModuleIndex = 0
		lookupCenter = 0, -0.2, 0
		lookupRadius = 1.5
	}
}

 

drag.png

With this patch, parts on the end of a fuel tank can be shielded by a nose-cone.  Parts attached to the wall of a nose cone, or hollow structural fuselage, can be rotated around their attachment point so as to be attached to the inside of the wall, or offset so their visual center is inside the fuselage, and they are shielded from drag.  

The shielded parts will show "cannot deploy while stowed" if they are parachutes or antennae or landing gear.  (The visual center of retractable gear, and thus their stowed-ness, depends on whether they are extended when the physics loads, which makes it harder to test their function on a craft, so it is good that landing gear now have the 'Deploy Shielded' override.)  Clipping parts into fuel tanks, and other non-hollow parts, remains purely cosmetic; drag remains. surfaceDrag.png

I suggest making this the default behavior.

Edited by OHara
add image showing difference between fuel tank and hollow fuselage
Link to comment
Share on other sites

  • 4 months later...

The Making History expansion includes more parts that one might expect to shield things inside:  Structural Tubes  and  Engine Plates with shrouds.

The additional module manager below patch shields contents of these new parts, when both ends of the enclosing tube are covered.  (I do not usually use the Making History expansion, so this patch is less-extensively tested than the one above patch.)

Spoiler

// Make Structural Tubes shield the parts inside them from drag
@PART[Tube*] {
    MODULE,0 {
        name = ModuleColorChanger
        toggleInEditor = false
        toggleInFlight = false
    }
    %MODULE[ModuleCargoBay] {
        DeployModuleIndex = 0
        lookupCenter = 0,-0.5,0 // Tubes extend from 0 to some negative Y
        lookupRadius = #$/MODEL:HAS[#scale[*]]/scale[0]$
        nodeOuterForeID = top2
        nodeOuterAftID = bottom2
        nodeInnerForeID = top1
        nodeInnerAftID = bottom1
    }}

// Make the engine-plate shrouds shield the parts inside them from drag
@PART[EnginePlate*] {
    %MODULE[ModuleCargoBay] {
        DeployModuleIndex = 3  // Index of the jettison module for all plates as of Aug2018
        lookupCenter = 0,-0.5,0 // Shrouds extend from 0 to some negative Y
        lookupRadius = #$/MODEL:HAS[#scale[*]]/scale[0]$
        nodeOuterForeID = top
        nodeOuterAftID = bottom
        nodeInnerForeID = top
        nodeInnerAftID = bottom
    }}

// repair bug 19376, missing configuration that is needed for parts with hollow ends
@PART[Tube1] {
	%DRAG_CUBE {
		cube = 0, 0.78,0.78,0.71, 0.78,0.78,0.71, 1.21,0.96,0.10, 1.21,0.96,0.10, 0.78,0.78,0.71, 0.78,0.78,0.71, 0,-0.3125,0, 1.25,0.625,1.25
		cube = 1, 1.56,0.78,0.71, 1.56,0.78,0.71, 1.21,0.96,0.10, 1.21,0.96,0.10, 1.56,0.78,0.71, 1.56,0.78,0.71, 0,-0.625,0,  1.25,1.25,1.25
		cube = 2, 2.36,0.77,0.68, 2.36,0.77,0.68, 1.21,0.96,0.10, 1.21,0.96,0.10, 2.36,0.78,0.68, 2.36,0.78,0.68, 0,-0.9375,0, 1.25,1.875,1.25
		cube = 3, 3.12,0.78,0.69, 3.12,0.78,0.69, 1.21,0.96,0.10, 1.21,0.96,0.10, 3.12,0.78,0.69, 3.12,0.78,0.69, 0,-1.25,0,   1.25,2.5,1.25
		cube = 4, 4.72,0.77,0.60, 4.72,0.77,0.60, 1.21,0.96,0.10, 1.21,0.96,0.10, 4.72,0.77,0.60, 4.72,0.77,0.60, 0,-1.875,0,  1.25,3.75,1.25
	}}
@PART[Tube1p5] {
	%DRAG_CUBE {
		cube = 0, 1.18,0.77,1.01, 1.18,0.77,1.01, 2.72,0.96,0.10, 2.72,0.96,0.10, 1.18,0.77,1.01, 1.18,0.77,1.01, 0,-0.3125,0, 1.875,0.625,1.875
		cube = 1, 2.36,0.77,1.01, 2.36,0.77,1.01, 2.72,0.96,0.10, 2.72,0.96,0.10, 2.36,0.77,1.01, 2.36,0.77,1.01, 0,-0.625,0,  1.875,1.25,1.875
		cube = 2, 3.52,0.78,1.01, 3.52,0.78,1.01, 2.72,0.96,0.10, 2.72,0.96,0.10, 3.51,0.77,1.00, 3.51,0.77,1.00, 0,-0.9375,0, 1.875,1.875,1.875
		cube = 3, 4.69,0.78,1.00, 4.69,0.78,1.00, 2.72,0.96,0.10, 2.72,0.96,0.10, 4.69,0.78,1.00, 4.69,0.78,1.00, 0,-1.25,0,   1.875,2.5,1.875
		cube = 4, 7.03,0.78,0.98, 7.03,0.78,0.98, 2.72,0.96,0.10, 2.72,0.96,0.10, 7.03,0.78,0.98, 7.03,0.78,0.98, 0,-1.875,0,  1.875,3.75,1.875
	}}
@PART[Tube2] {
	%DRAG_CUBE {
		cube = 0, 1.56,0.77,1.31, 1.56,0.77,1.31, 4.78,0.95,0.10, 4.78,0.95,0.10, 1.56,0.77,1.31, 1.56,0.77,1.31, 0,-0.3125,0, 2.5,0.625,2.5
		cube = 1, 3.12,0.77,1.31, 3.12,0.77,1.31, 4.78,0.95,0.10, 4.78,0.95,0.10, 3.12,0.77,1.31, 3.12,0.77,1.31, 0,-0.625,0,  2.5,1.25,2.5
		cube = 2, 4.68,0.77,1.31, 4.68,0.77,1.31, 4.78,0.95,0.09, 4.78,0.95,0.09, 4.68,0.77,1.31, 4.68,0.77,1.31, 0,-0.9375,0, 2.5,1.875,2.5
		cube = 3, 6.25,0.77,1.31, 6.25,0.77,1.31, 4.78,0.95,0.09, 4.78,0.95,0.09, 6.25,0.77,1.31, 6.25,0.77,1.31, 0,-1.25,0,   2.5,2.5,2.5
		cube = 4, 9.44,0.77,1.26, 9.44,0.77,1.26, 4.78,0.95,0.09, 4.78,0.95,0.09, 9.44,0.77,1.26, 9.44,0.77,1.26, 0,-1.875,0,  2.5,3.75,2.5
	}}
@PART[Tube3] {
	%DRAG_CUBE {
		cube = 0, 4.72,0.76,1.92, 4.72,0.76,1.92, 11.00,0.96,0.10, 11.00,0.96,0.10, 4.72,0.76,1.92, 4.72,0.76,1.92,  0,-0.625,0,    3.75,1.25,3.75
		cube = 1, 7.03,0.77,1.92, 7.03,0.77,1.92, 11.00,0.96,0.09, 11.00,0.96,0.09, 7.03,0.77,1.92, 7.03,0.77,1.92,  0,-0.9375,0,   3.75,1.875,3.75
		cube = 2, 9.44,0.77,1.92, 9.44,0.77,1.92, 11.00,0.96,0.09, 11.00,0.96,0.09, 9.44,0.77,1.92, 9.44,0.77,1.92,  0,-1.25,0,     3.75,2.5,3.75
		cube = 3, 14.06,0.77,1.92, 14.06,0.77,1.92, 11.00,0.96,0.09, 11.00,0.96,0.09, 14.06,0.77,1.92, 14.06,0.77,1.92, 0,-1.875,0, 3.75,3.75,3.75
		cube = 4, 18.75,0.77,1.90, 18.75,0.77,1.90, 11.00,0.96,0.10, 11.00,0.96,0.10, 18.75,0.77,1.90, 18.75,0.77,1.90, 0,-2.5,0,   3.75,5,3.75
	}
}
@PART[Tube4] {
	%DRAG_CUBE {
		cube = 0, 6.25,0.77,2.52, 6.25,0.77,2.52, 20,0.95,0.10, 20,0.95,0.10, 6.25,0.77,2.52, 6.25,0.77,2.52,   0,-0.625,0,   5,1.25,5
		cube = 1, 9.37,0.77,2.52, 9.37,0.77,2.52, 20,0.95,0.09, 20,0.95,0.09, 9.37,0.77,2.52, 9.37,0.77,2.52,   0,-0.9375,0,  5,1.875,5
		cube = 2, 12.5,0.77,2.52, 12.5,0.77,2.52, 20,0.95,0.09, 20,0.95,0.09, 12.5,0.77,2.52, 12.5,0.77,2.52,   0,-1.25,0,    5,2.5,5
		cube = 3, 18.75,0.77,2.52, 18.75,0.77,2.52, 20,0.95,0.09, 20,0.95,0.09, 18.75,0.77,2.52, 18.75,0.77,2.52, 0,-1.875,0, 5,3.75,5
		cube = 4, 25.00,0.77,2.52, 25.00,0.77,2.52, 20,0.95,0.10, 20,0.95,0.10, 25.00,0.77,2.52, 25.00,0.77,2.52, 0,-2.5,0,   5,5,5
	}}

 

 

Edited by OHara
added a fix for bug 19376
Link to comment
Share on other sites

  • 2 weeks later...
On 9/23/2018 at 8:55 AM, Rocket In My Pocket said:

Umm..why are we holding our breath for squad to do this (when we know full well they never will) if it's just a module manager patch?

Release it as a mod already!

Why wouldn't they?  It would be trivially easy and its basically a bug.  

Link to comment
Share on other sites

I think this is a great idea.  As a newer player I was completely flummoxed by having my batteries inside a hollow nose cone burn up at speed.  It was only via these forums that I got that figured out.  You should not need a mod to have the physics behave in a more rational manner.

Link to comment
Share on other sites

10 hours ago, DAL59 said:

Why wouldn't they?  It would be trivially easy and its basically a bug.  

I'd wager it's an intentional design decision on their part to discourage heavy part clipping/make fairings and bays more useful more so than a bug.

Also, I mean c'mon. Even if it was a "bug" or an oversight we're talking about Squad here. It's been in the game this long, it ain't going nowhere lol.

I think most of us, including you; have been here long enough to know better than to hold our breath waiting for them lol. I'd have packaged this up and released it myself already, but I don't want to step on anyone's toes. If nothing else; as a stop gap measure until Squad potentially does something official.

Edited by Rocket In My Pocket
Link to comment
Share on other sites

41 minutes ago, Rocket In My Pocket said:

Also, I mean c'mon. Even if it was a "bug" or an oversight we're talking about Squad here. It's been in the game this long, it ain't going nowhere lol.

We have an exception to this rule coming up in 1.5. How long has the current flawed manoeuvre node system been in the game? SQUAD are fixing that now.

Link to comment
Share on other sites

There are at least 3 bug reports on this issue, some of which have been around since about the time MH was released. Both for the tubes to occlude parts within them, and to fix the trivially simple drag cubes (the problems associated with drag cubes for hollow parts are well known and easy to work around) that make these parts terrible for drag.

So it's not like they aren't aware of the issue. :rolleyes:

Link to comment
Share on other sites

1 hour ago, RealKerbal3x said:

We have an exception to this rule coming up in 1.5. How long has the current flawed manoeuvre node system been in the game? SQUAD are fixing that now.

Fair enough, but I'm not sure pointing out how long a flawed system has been in the game really helps that argument.

Making it a mod for now certainly won't hurt either, even if it's only to hold us over till an official fix/change. (However unlikely I still find that to be.)

Link to comment
Share on other sites

@OHara Thanks for sharing these, missed them before. Is there a reference somewhere to what each line does? Be useful for others to add configs for more parts.

Some parts use this syntax:

%MODULE[ModuleCargoBay] {
		DeployModuleIndex = 0
		lookupRadius = 1.0
		nodeOuterForeID = top
		nodeOuterAftID = bottom
		nodeInnerForeID = top
		nodeInnerAftID = bottom
	}

While others look like this:

%MODULE[ModuleCargoBay] {
		DeployModuleIndex = 0
		lookupCenter = 0, 0.1, 0
		lookupRadius = 0.5
	}

Thanks!

Link to comment
Share on other sites

@Tyko ,the system was explained rather well by HarvesteR when it was introduced: https://forum.kerbalspaceprogram.com/index.php?/developerarticles.html/on-cargo-bays-and-part-occlusion-r156/  The parameters are sparsely documented at https://kerbalspaceprogram.com/api/class_module_cargo_bay.html.  Some parts have one end-wall at their local-coordinate origin; these need a non-zero lookupCenter so the search for enclosed parts finds the parts before hitting that end-wall.

The node* variables support a check if the stack-able ends of cargo-bays are open to the air or covered by the next part in the stack.  I set these node* variables for completeness, but I do not find that extra check to be realistic. If an Mk2 bay is ever the top of a stack,  its opening gets the drag of a flat-plate of its cross-sectional area.  The air inside will be rather still, so I see no need to estimate extra drag of the full airspeed on the contents.

@Dafni, simple changes like these can be installed by putting the configuration lines above into a new or existing configuration file for the very popular mod Module Manager.  Many of us contribute such patches here https://forum.kerbalspaceprogram.com/index.php?/topic/139980-130-community-database-of-module-manager-patches-for-stock-ksp/  I do not use the mod-hosting sites (except for github) so will not be putting these drag-patches there; they would merely be the contents in my spoilers above plus individual no-rights-reserved statement and the version-check file.

 

I also expect no changes in this area from Squad, but I think making well-considered suggestions at least increases the odds of getting the changes that  users want into stock.  

There is an argument that  making nose-cones into containers disrupts balance, so we might suggest increasing mass or cost to make hollow parts closer in cost/benefit to the service bays.

The obvious bug with the Making History tubes, missing definition for effective areas, might also go unfixed.  That bug swamps any benefit of my later patch, so I'll insert the missing definition to the relevant spoiler block above.

Edited by OHara
Link to comment
Share on other sites

  • 10 months later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...