Jump to content

[SOLVED] How to set up multi-nozzle group switching?


Recommended Posts

I have the engine below set up in Unity to emit thrust from each nozzle, but I'd like to be able to enable switching between groups of active nozzles while in flight. Say, all five active, the outer four active, or just the middle active at any one time. Is this possible? I tried yesterday to use the MultiModeEngine module used by the rapier, but if I'm mistaken, it only appears to be able to switch between two modes, and those modes seem to favor airbreathing/closed cycle switching. I also tried creating sets of thrust transforms for each mode that I wanted, but this required childing multiple copies of each engine bell. This sort of worked, but I could only get two engines running at a time, and in the 4 nozzle mode there were multiple emitters coming from the center...which I had not set up to use thrustTransform4noz lol. Plus I doubt it's a good idea to have copies of the nozzles. If there was a way to call on multiple thrust transforms in one ModuleEngineFX block I could maybe see another way to do it, but at this point I'm stumped.

Anyway, is a set up like this possible with Unity and stock modules, and how would I go about setting it up if it is? Thanks :)

8yNTmbb.png

Edited by Quiznos323
Link to comment
Share on other sites

you would have to have groups of thrust transform with different names, then set each engine mode to use different set of thrust transforms. center one might be thrustTransformCenter; outside ones might be thrustTransformOuter (all share the same name)

Link to comment
Share on other sites

I've never tried but the only way to do something even remotely similar, of which I can think is to have multiple ModuleEnginesFX referring to different thrust transforms.
you would have to have groups of thrust transform with different names, then set each engine mode to use different set of thrust transforms. center one might be thrustTransformCenter; outside ones might be thrustTransformOuter (all share the same name)

Ok, so would it be possible to have, say, nozzle1 childed to both thrustTransform4Nozzles and thrustTransform5Nozzles? Because to my understanding the Unity hierarchy for multi-nozzles goes EmptyEngineObj -> thrustTransform -> nozzleObj for each nozzle.

Edit: Ah ok nli2work I see what you are saying. So if I wanted a 3rd option to have all five running, how would I call both thrustTransformCenter and thrustTransformOuter at the same time?

Edited by Quiznos323
Link to comment
Share on other sites

Ah ok nli2work I see what you are saying. So if I wanted a 3rd option to have all five running, how would I call both thrustTransformCenter and thrustTransformOuter at the same time?

if you want more than 2 options; you might be able to do it with without MultiModeEngine (that only switches between mode A and B, and can't have both at the same time). then set action groups in game to toggle different sets. you may be able to set different transforms to the same ModuleEngine though I don't know what syntax it would require, I can't say for sure if it'll work, never tried having multiple engine modules on a part without ModuleMultiMode

Edited by nli2work
Link to comment
Share on other sites

For parenting, you MIGHT be able to nest them. .. going:

Transform1>transform2>enginebell.

Two other choices:

1. Don't parent the bell to the transforms. Thrust will still vector but bell won't visibly move, which for the narrow range of gimbal and view distances probably won't bother anyone.

2. Instead of parenting the bell, parent an empty game object to each transform and use a pair of lookat constraints to make the nozzle track them both. Perhaps applying one directly to the nozzle and one to an empty above it.

Link to comment
Share on other sites

Yes, you can nest the transforms. I did multi-mode clusters in SpaceY. But yes, the rapier multi-mode system only enables two modes. It'll still offer a UI button for automatic switching, which does nothing if both modes are closed-cycle (not air breathing).

If you want an example of how I set up the thrust effect emission transforms and so on, you can look at the clusters in SpaceY. All three of them have multi-mode options now. The 5-nozzle engines are configured to allow shutting off the center one, and the 9-way allows you to shut off the outer ring of 8 and run just the center.

The down-side is that the heat animation can only be created once, so while some engines are turned off, they'll glow just as much in both modes.

But basically this is how it works... if I want an engine to have 4 outer engines that are always on, and the center one can be switched off, I'd have something like:

Center engine:

thrustTransform -> centerBell -> fxTransform

Outer engines:

outerTransform -> thrustTransform -> engineBell -> fxTransform + outerFXtransform

That way the engine mode that refers to "thrustTransform" and "fxTransform" will see all of them, and the one that uses "outerTransform" and "outerFXtransform" only sees the other 4. This still allows for the bells to animate with gimbal.

The exhaust effects have to be set up twice, corresponding to those modes.

Link to comment
Share on other sites

Ah ok, thanks for the reply, I'll give it a try. A question I have though: How do your "thrustTransform", "outerTransform", "fxTransform", and "outerFXTransform" differ? I see in your cfgs that the ModuleEngineFX blocks reference different transforms than the MODEL_MULTI_PARTICLE blocks.... I guess I just don't understand where exactly the effect is generated from, and what the function of each type of transform is lol.

Link to comment
Share on other sites

I'll use the M9 engine as an example. I'm pasting in the relevant part of the code here in case anyone else is following along and wants to see:




EFFECTS
{
running_full
{
AUDIO
{
channel = Ship
clip = sound_rocket_spurts
volume = 0.0 0.0
volume = 1.0 1.0
pitch = 0.0 0.2
pitch = 1.0 1.0
loop = true
}
PREFAB_PARTICLE
{
prefabName = fx_smokeTrail_veryLarge
transformName = smokeTransform
emission = 0.0 0.0
emission = 0.05 0.0
emission = 0.075 0.25
emission = 1.0 1.25
speed = 0.0 0.25
speed = 1.0 1.0
localOffset = 0, 0, 1
}
MODEL_MULTI_PARTICLE
{
modelName = Squad/FX/ks25_Exhaust
transformName = fxTransform
emission = 0.0 0.0
emission = 0.05 0.0
emission = 0.075 0.25
emission = 1.0 1.25
speed = 0.0 0.5
speed = 1.0 1.2
}
}
running_four
{
AUDIO
{
channel = Ship
clip = sound_rocket_spurts
volume = 0.0 0.0
volume = 1.0 1.0
pitch = 0.0 0.2
pitch = 1.0 1.0
loop = true
}
PREFAB_PARTICLE
{
prefabName = fx_smokeTrail_veryLarge
transformName = smokeTransform
emission = 0.0 0.0
emission = 0.05 0.0
emission = 0.075 0.25
emission = 1.0 1.25
speed = 0.0 0.25
speed = 1.0 1.0
localOffset = 0, 0, 1
}
MODEL_MULTI_PARTICLE
{
modelName = Squad/FX/ks25_Exhaust
transformName = outerfxTransform
emission = 0.0 0.0
emission = 0.05 0.0
emission = 0.075 0.25
emission = 1.0 1.25
speed = 0.0 0.5
speed = 1.0 1.2
}
}
engage
{
AUDIO
{
channel = Ship
clip = sound_vent_soft
volume = 1.0
pitch = 2.0
loop = false
}
}
flameout
{
PREFAB_PARTICLE
{
prefabName = fx_exhaustSparks_flameout_2
transformName = smokeTransform
oneShot = true
}
AUDIO
{
channel = Ship
clip = sound_explosion_low
volume = 1.0
pitch = 2.0
loop = false
}
}
}

MODULE
{
name = MultiModeEngine
primaryEngineID = AllEngines
secondaryEngineID = CenterOff
}

MODULE
{
name = ModuleEnginesFX
engineID = AllEngines
runningEffectName = running_full
thrustVectorTransformName = thrustTransform
exhaustDamage = True
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 4400
heatProduction = 410
fxOffset = 0, 0, 0.25
engineAccelerationSpeed = 0.3
engineDecelerationSpeed = 0.5
PROPELLANT
{
name = LiquidFuel
ratio = 0.9
DrawGauge = True
}
PROPELLANT
{
name = Oxidizer
ratio = 1.1
}
atmosphereCurve
{
key = 0 360
key = 1 280
}

}

MODULE
{
name = ModuleEnginesFX
engineID = CenterOff
runningEffectName = running_four
thrustVectorTransformName = outerTransform
exhaustDamage = True
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 3520
heatProduction = 410
fxOffset = 0, 0, 0.25
engineAccelerationSpeed = 0.3
engineDecelerationSpeed = 0.5
PROPELLANT
{
name = LiquidFuel
ratio = 0.9
DrawGauge = True
}
PROPELLANT
{
name = Oxidizer
ratio = 1.1
}
atmosphereCurve
{
key = 0 360
key = 1 280
}

}

Basically in "ModuleEnginesFX", the transform you define in "thrustVectorTransformName" determines what transform gets gimballed, and where the thrust force is applied. The "runningEffectName" variable tells it which effects to apply while that engine is running. So basically, since I have either "thrustTransform" or "outerTransform" specified, it will use one of those transforms to determine the thrust direction and to gimbal anything contained inside those transforms, or children of them.

So then I also have "running_full" and "running_four" as the two different effects that those "ModuleEnginesFX" sections refer to. You'll see that both call "smokeTransform" for the smoke, which is just a single transform under the center engine (so it makes one smoke trail, no matter how many engines are running). "fxTransform" and "outerfxTransform" both occupy the same position as each other, at the bottom (opening) of the engine bell, except of course that there is no "fxTransform" for the center one.

Same goes for "thrustTransform" and "outerTransform". They both occupy the same positions, at the top of the engine bells, which acts as the gimbal pivot point. And again, all of the engine bells have both, except the center one which just gets thrustTransform, so that it can be shut off.

Feel free to copy the config and transform names and the like. It's confusing the first time through, for sure. :)

Link to comment
Share on other sites

transformName = in PREFAB_PARTICLE{} or MODEL_MULTI_PARTICLE{} is where a particle FX is placed when the engine is running

thrustVectorTransformName = in ModuleEngine{} or ModuleEngineFX{} is where force is applied when engine is running. a collider directly behind (up to 10m I think) the transform will "block" the exhaust and 0 force will be applied.

they can use the same transform, or different transforms.

all transforms with the same name will have the same particle FX. location of thrust is the average position of transforms given to thrustVectorTransformName =

Link to comment
Share on other sites

Got it to work! Just have to texture now.

And the smoke is off to the side..

prefab smoke emitters go in -Y direction (not +Z like thrust), so you need a separate transform for smoke trails. it's odd ball... but dem's the breaks.

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