• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Hide Engine code when Cowling is Closed

Messages
10,163
Country
us-arizona
Hey gang,


Lets say I wanted to hide a TON of polygons when my cowling closes. How might the code be written for such a 'visibility' cue?


First, I have 'open_cowling' command. This causes the cowling to animate off of the craft and onto the tarmac.

Next, I create a code that will unhide the cowling when it begins its animation. So then, when the cowling goes to animation point 1 from zero through 100, the polygon assembly appears.

I guess one would create a percentage trigger, 1+ percent and greater then, 'then' visible.

Ok... Thanks.. lol.. In writing this, I kind of saw better how it might be done.

I'll publish the code when I get it working.



Bill
 
What about setting a custom variable to "1" when the cowling is in place and link the visibility of the engine to that variable?
Say custom variable reads "1" -> engine invisible; variable reads "0" -> engine invisible.
Controlling visibility can be achieved with those visibility tags.


At least's how I'd do it.
 
Last edited:
<sigh>

All of these things have been done and published in the XML Parts forum at Freeflight Design for years now... :banghead:
 
<sigh>

All of these things have been done and published in the XML Parts forum at Freeflight Design for years now... :banghead:

In my defense, I haven't looked there since I don't need XML for my model...yet. ;)
 
Here is the working code.





Code:
    <PartInfo> 
    <Name>lhc_cowling_remove_switch</Name>
	  <AnimLength>100</AnimLength>
	  <Animation>
		  <Parameter>
			 <Code>(L:COWLING REMOVE,bool) 100 *</Code>
			<Lag>50</Lag>
		  </Parameter>
	   </Animation> 
    <MouseRect>
	  <Cursor>Hand</Cursor>
	<TooltipText>Open Ice Cooler</TooltipText>
	  <CallbackCode>
    (L:COWLING REMOVE,bool) ! (>L:COWLING REMOVE,bool)  
               1 (&gt;L:XMLSND4,enum)
	  </CallbackCode>
    </MouseRect>
</PartInfo>




<PartInfo> 
    <Name>lhc_hide_engine</Name>
	  <Visibility>
		<Parameter>
		<Code>(L:COWLING REMOVE, bool)</Code>
		</Parameter>
	</Visibility>
</PartInfo>


You would use the lhc_hide_engine 'visibility' attachment in FSX tools to link the engine block to, then link all its parts to it you wish to hide.

Then you animate your cowling, and tag it with an Animation; lhc_cowling_remove_switch, then add a gauge or switch in the VC or panel that will activate this, attach the same code to that.

On mine, there is a sound code as well, which you would need an entire system for. I purchased one from Fr. Bill, so if you all need a sound system for clicks and things, he produces a very good package that is affordable for the smaller groups. (I hope you dont mind me advertising your work Bill).

To take the sound out, remove this string;
Code:
               1 (&gt;L:XMLSND4,enum)


And yes, this animation will work both the switch for the cowling, as well as the cowling itself. Thus, you click on the switch, the cowling begins its flight from zero to 100 frames, and your engine appears just at the millisecond that the cowling begins movement, frame one.

:d


Bill
 
The question is: does it really have an impact on the performance? I am just wondering whether or not the invisible are really invisible for the graphics engine. Maybe the parts are still calculated, but just not shown if you know what I mean...

Cheers,
Vitus
 
The question is: does it really have an impact on the performance? I am just wondering whether or not the invisible are really invisible for the graphics engine. Maybe the parts are still calculated, but just not shown if you know what I mean...

Cheers,
Vitus
I never did get around to testing it in fsx but Im pretty sure the sim skips over the draw of a part if vis code is used.Id even go far to say its up to something if thepollys are not in the direct line of view,not sure what but if I move around in the VC my FPS changes sufficiently for me to conclude that somethings a foot.Prob just a slow pixel shader engine on my video card but I see a 6 to 7 fps change from looking straight ahead to looking down at the panel and controls this is with the sim paused and no snd.
Wozza
 
I never did get around to testing it in fsx but Im pretty sure the sim skips over the draw of a part if vis code is used.Id even go far to say its up to something if thepollys are not in the direct line of view,not sure what but if I move around in the VC my FPS changes sufficiently for me to conclude that somethings a foot.Prob just a slow pixel shader engine on my video card but I see a 6 to 7 fps change from looking straight ahead to looking down at the panel and controls this is with the sim paused and no snd.
Wozza

Very odd that you mention this. It was effecting my flight last night in FSX so bad, I was ready to clobber the computer. Looking at the panel would bring the frame rates down to 4 FPS after flying for say 15 min's. It was gradual. What I would do is save 'in-flight' and reboot FSX. Back to normal. Thus, my flight of 1 1/4 hours was with 3 reboots of FSX. The plane I was flying was the Carenado Piper Archer II. Looking out the sides, my frame rates would go up to 12 - 19 FPS. This is with 'no hidden engine' mind you.


On hiding the engine and performance, I am certain that if you have the engine hide, that the performance should radically climb up. In FS2004, they created hiding landing gear bays to help performance. Once the gear is up fully, the entire gear bay disappears. (Optionally, not automatic). It would be odd if this were 'not' the case with FSX. (I should test this also before talking about it, lol... ).
 
Bill (Leaming),

I have a problem. My engine unhides when the cowling is returning home.

How could I make the code to keep the engine showing until the cowling is closed?
 
Bill (Leaming),

I have a problem. My engine unhides when the cowling is returning home.

How could I make the code to keep the engine showing until the cowling is closed?

Your variable is a boolean, so the instant it switches from 1 to zero your engine will disappear. I'll have to think about this overnight... ;)
 
Last edited:
Hi Bill,

the code is over at FFFDSFFDSSD or... whatever :D

Hi Bill,

I have an idea, but as you asked Bill explicitly, I refuse to answer and moue instead :p

Cheers,
Vitus
 
Ahhhh you guys are so mean :)
Poor Bill prob on a tight time frame.........

Bill you can do it a number of ways but of late I tend to use this syntax for vis code
Code:
 <PartInfo>
	<Name>lhc_hide_engine</Name>
	<Visibility>
	    <Parameter>
	<Code>
	     (L:COWLING REMOVE, number) 2 &gt; if{ 1 } els{ 0 }
	</Code>
	    </Parameter>
	</Visibility>
   </PartInfo>
As you have times-ed the bool command by 100 in you cowl code the L:COWLING REMOVE will generate an output of 0 all the way to 100 when toggled.the code above will monitor the L:COWLING REMOVE Var and when its output is higher than kf 2 it will show ;)

Wozza
 
A thousand thanks Wozza.

Saves me some time going through all the pages of entries. I owe you one.


Bill
LHC
 
Hey guys,


Bearing bad news. I didnt want to post this until I had a fix, but I may need help fixing it instead.

It seems the engine bay still hides when the cowling starts to return.
1. Click 'Remove Cowling', door opens, engine is visible.
2. Click again, cowling begins flight to start point, engine assembly immediately disappears when cowling begins movement.

Any ideas why the engine isnt waiting till the cowling is at point zero before hiding?


arrghh..



Bill
 
Hey guys,


Bearing bad news. I didnt want to post this until I had a fix, but I may need help fixing it instead.

It seems the engine bay still hides when the cowling starts to return.
1. Click 'Remove Cowling', door opens, engine is visible.
2. Click again, cowling begins flight to start point, engine assembly immediately disappears when cowling begins movement.

Any ideas why the engine isnt waiting till the cowling is at point zero before hiding?


arrghh..



Bill
Hi Bill
can you post the code your using again(just to make sure no typos )
In the mean time try the animation without the lag command.I know it will be to fast but its just a check to see if the lag command is causing the animation to lag behind the bool command
Wozza
 
Last edited:
Hi Bill
can you post the code your using again(just to make sure no typos )
In the mean time try the animation without the lag command.I know it will be to fast but its just a check to see if the lag command is causing the animation to lag behind the bool command
Wozza


Hey Wozza,

Here is the code;


Code:
    <PartInfo> 
    <Name>lhc_cowling_remove_switch</Name>
	  <AnimLength>100</AnimLength>
	  <Animation>
		  <Parameter>
			 <Code>(L:COWLING REMOVE,bool) 100 *</Code>
			<Lag>10</Lag>
		  </Parameter>
	   </Animation> 
    <MouseRect>
	  <Cursor>Hand</Cursor>
	<TooltipText>Open Ice Cooler</TooltipText>
	  <CallbackCode>
    (L:COWLING REMOVE,bool) ! (>L:COWLING REMOVE,bool)  
               1 (&gt;L:XMLSND4,enum)
	  </CallbackCode>
    </MouseRect>
</PartInfo>


<PartInfo> 
    <Name>lhc_hide_engine</Name>
	  <Visibility>
		<Parameter>
		<Code>(L:COWLING REMOVE, percent) 2 &gt; if{ 1 } els{ 0 }</Code>
		</Parameter>
	</Visibility>
</PartInfo>

I'll give that lag test a try. If its lightning fast though, I do not know if I can see if the engine assembly is hiding, can I?

This turned out to be a little more difficult then I thought it would be. Seems I have had things work perfectly fine with something like this in the past. I used their code and its not working for this setup.

The second code above is the visibility only code (FSX/Attachpoint/Viz).

hmm....



Bill
 
Last edited:
Bill, you have the vis code using 'percent' as the unit type. Try changing all of the other entries for the L:var to 'percent' instead of 'bool'...
 
Back
Top