Jump to content

Plugin to allow multi-part fairings / boost protect covers to work in stock 1.0x aero


Recommended Posts

Note: This is mutually exclusive from my SDHI AeroFairings project, for reasons to be explained shortly.

KSP 1.0 introduced a new aero drag occlusion system, along with stock procedural fairings - while I know that e-dog's Procedural Fairings is compatible with stock aero, I prefer multipart or limited-configuration fairings as they enforce sensible payload design.

The problem is that, due to the way stock aero was devised, KW Rocketry's multipart fairings, SDHI SMS's interstage fairing and pod boost protect covers and similar fairing systems no longer occlude drag properly.

A plugin (or better yet, an update to the game itself) to allow stock aero to properly handle multipart fairings would be greatly appreciated.

For those who say "Just use nuFAR and its new voxel occlusion system", I'll state that I do in fact prefer FAR, but I want these multipart fairings to work in stock aero too.

Link to comment
Share on other sites

Why not something like AIES fairings if they was update would they work better ?

No, because AIES fairings are still technically multipart fairings.

EDIT: To clarify, a multipart fairing is where the fairing pieces are separate parts from the fairing base. KW Rocketry Fairings have fairing halves built up of individual segments, while AIES fairings halves are single pieces, but from the perspective of the stock aero system, both are considered multipart fairings.

Edited by sumghai
Link to comment
Share on other sites

[MOD - Moving to Plugin Development Help subforum, since what follows is now technical content]

Okay, so after some discussion on IRC, I've gathered some useful information that may help the development of this plugin.

- ModuleCargoBay is (to my knowledge) the only way the game handles drag occlusion for hollow parts, and has the following key parameters:

DeployModuleIndex is the index of the animation module that opens your cargo bay. If your deploy animation is the first module in your part config, this should be 0. If it is the 2nd module, this should be 1. 3rd = 2 ....

ClosedPosition is the position in your animation that represents closed. If your animation goes from closed ->open, this should be 0. If your animation starts open and goes to closed, this should be 1.

lookupRadius is probably the distance from the center of mass of the cargo bay to do part containment lookup. On all stock cargo bays this is set to half the length of the cargo bay; so a 10m long bay would have a value of 5.

- For "true" cargo bays, such as the stock Mk3 Cargo Bay CRG-100, DeployModuleIndex listens for a change in the state of a specified/preceding ModuleAnimateGeneric that opens/closes the bay doors, and ClosedPosition for the actual end state itself. Once triggered, ModuleCargoBay would then raycast against the cargo bay's colliders to determine the shielded state of the payload inside the bay.

- The stock procedural fairings also use ModuleCargoBay to determine atmo drag occlusion; however, the proc fairing CFGs don't have ModuleAnimateGeneric, but instead, has ModuleProceduralFairing

- I suspect what's happening is that ModuleProceduralFairing is actually creating a "dummy" animation that ModuleCargoBay can consult to determine whether the fairings are intact (payload shielded) or jettisoned (payload exposed to atmo drag)

- In terms of my original request, the idea is to thus create a new "helper" PartModule that tricks ModuleCargoBay into using a decoupler staging action (ModuleDecoupler/ModuleAnchoredDecoupler) as a valid animation:

i.e. ModuleDecoupler/ModuleAnchoredDecoupler ---> ModuleDecouplerListenerForCargoBay ---> ModuleCargoBay


Additional notes:

- ModuleCargoBay's lookupRadius is measured from the part's CoM, so many fairings will need to have their part origins changed mid-way along their height, and the lookupRadius specified as half the height

- Because ModuleCargoBay must be able to listen to a change in animated state from either ModuleAnimateGeneric, ModuleProceduralFairing or the proposed ModuleDecouplerListenerForCargoBay, faring segments parts that only have ModuleCargoBay won't work.

(Specifically, SDHI's fairings and BPC are single-length segments with built-in decouplers, and so these parts would work fine with the new listener module. On the other hand, KW Rocketry fairings have the decoupler only in the cone pieces and not the side panels that make up its length, and so even if the KW fairing side panels each had ModuleCargoBay, they can't listen to the decoupler action from another part)

So... any takers for this request? :)

Link to comment
Share on other sites

According to Sarbian via IRC, apparently ModuleProceduralFairings directly instructs ModuleCargoBay how to alter its drag occlusion behaviour, instead of merely providing an animation state change like ModuleAnimateGeneric does.

Further investigation is needed to understand how ModuleProceduralFairings and ModuleAnimateGeneric pass on information to ModuleCargoBay.

Link to comment
Share on other sites

Have some rep! I literally just finished making some multi part fairings and then looked up some information about them only to find they no longer work with stock aero. so this is greatly appreciated and i wish you the best of luck in your endeavors!

Link to comment
Share on other sites

Thinking out loud:

Thought 1: Is it possible to use ModuleCargoBay with fairing bases to make an invisible bay for shielding and have your fairings wrap around it for the visuals instead of having the fairings do the shielding?

Thought 2: Does anyone know if there is a way to use ModuleProceduralFairing and preset the fairing sizes via .cfg and use your own fairing textures to make the fairings?

Edit: for presets I mean using the xSectionHeight's and all those other things in the stock fairing .cfg's to make the fairing without having to click and drag it. Maybe you just need a plugin to override the user input.

Edited by Dave7
Link to comment
Share on other sites

Thought 1: Is it possible to use ModuleCargoBay with fairing bases to make an invisible bay for shielding and have your fairings wrap around it for the visuals instead of having the fairings do the shielding?

My understanding of ModuleCargoBay is that it raycasts drag occlusion based on a fairing/cargo bay's colliders - there's not much point having a visual mesh for the fairing itself and a separate invisible mesh for the collider, if the fairing collider can be made as part of the original fairing model itself.

Thought 2: Does anyone know if there is a way to use ModuleProceduralFairing and preset the fairing sizes via .cfg and use your own fairing textures to make the fairings?

Edit: for presets I mean using the xSectionHeight's and all those other things in the stock fairing .cfg's to make the fairing without having to click and drag it. Maybe you just need a plugin to override the user input.

I thought about that as well, but according to various sources, Harvester (who wrote both ModuleCargoBay and ModuleProceduralFairings) never really wrote his code with moddability in mind, and I suspect it'd be difficult to get a hold of him to explain the each of the parameters and possible values.

Link to comment
Share on other sites

I thought about that as well, but according to various sources, Harvester (who wrote both ModuleCargoBay and ModuleProceduralFairings) never really wrote his code with moddability in mind, and I suspect it'd be difficult to get a hold of him to explain the each of the parameters and possible values.

Have you checked with edog about this? His procedural fairings mod is shielding parts and its using multiple fairing parts. Granted they are being modified (scale & shape) after placement and maybe his code is changing other stuff with them also, I haven't checked, but it should be possible to use your fairings with just .cfg changes or maybe a plugin to add whatever ModuleProceduralFairings needs to calculate the enclosed area or whatever its doing. I haven't had time to look at it much.

Link to comment
Share on other sites

Have you checked with edog about this? His procedural fairings mod is shielding parts and its using multiple fairing parts. Granted they are being modified (scale & shape) after placement and maybe his code is changing other stuff with them also, I haven't checked, but it should be possible to use your fairings with just .cfg changes or maybe a plugin to add whatever ModuleProceduralFairings needs to calculate the enclosed area or whatever its doing. I haven't had time to look at it much.

Starwaster has already had a look at ModuleCargoBay and ModuleProceduralFairings, and he thinks he may have an idea or two.

Link to comment
Share on other sites

  • 3 weeks later...

I'm really looking forward to hearing what you guys can come up with. My 0-Point Inline Fairings mod is strictly FAR/NEAR only right now, until we can find a solution.

If it's possible to make it work with visual model and not just colliders, that would be fantastic. Right now, my fairings mod uses the stock "ModuleJettison" engine fairing panel system (like the LV-N engine). Each of my fairing bases has four different fairing lengths, depending on which attachment node you use, so ray-casts would have to be based on the current panels, and not the inactive ones. The panels don't have colliders at the moment, and it would be a bit of a nightmare to add them all (2 half-cylinders per length (4) per base (3). If each "panel" were to use 6 rectangular colliders to approximate a 12-sided cylinder, that comes out to each base needing 48 new colliders, not including the front ends which would also need colliders).

Do you think this plugin might work for my fairings?

Link to comment
Share on other sites

  • 2 weeks later...

Okay, got some mostly good news.

Starwaster's Animated Decouplers plugin has been updated such that it now works in conjunction with the stock ModuleCargoBay - in layman's terms, AD provides a range of derivative decoupler modules that come with an animation argument, which allows the ModuleCargoBay to update its drag occlusion state once the fairing parts are decoupled.

This has already been implemented on the dev version of SDHI SMS with excellent results in stock aero (FAR uses voxel-based emergent drag occlusion calculation, and so isn't affected).

The caveat is that this plugin doesn't (yet) work for fairing pieces made up of multiple segments (such as the old KW Rocketry fairings), where not all the fairing pieces have the modified decoupler module that ModuleCargoBay needs to listen for in order to update its drag occlusion state.

I'm really looking forward to hearing what you guys can come up with. My 0-Point Inline Fairings mod is strictly FAR/NEAR only right now, until we can find a solution.

If it's possible to make it work with visual model and not just colliders, that would be fantastic. Right now, my fairings mod uses the stock "ModuleJettison" engine fairing panel system (like the LV-N engine). Each of my fairing bases has four different fairing lengths, depending on which attachment node you use, so ray-casts would have to be based on the current panels, and not the inactive ones. The panels don't have colliders at the moment, and it would be a bit of a nightmare to add them all (2 half-cylinders per length (4) per base (3). If each "panel" were to use 6 rectangular colliders to approximate a 12-sided cylinder, that comes out to each base needing 48 new colliders, not including the front ends which would also need colliders).

Do you think this plugin might work for my fairings?

The stock ModuleCargoBay requires colliders in order for raycasting for drag occlusion to work, so I don't think visual-only meshes would be supported..

Link to comment
Share on other sites

The stock ModuleCargoBay requires colliders in order for raycasting for drag occlusion to work, so I don't think visual-only meshes would be supported..

I figured that would probably still be the case. I did some test runs last week with colliders added to one of my fairings, and it still didn't seem to provide occlusion to payload with AD at the time.

Link to comment
Share on other sites

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...