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

FS2004 Problem with bitmap rotation

Messages
231
Country
us-alabama
I am trying to get my Attitude_Cage_Button.bmp to rotate when the mouse area for attitude cage is clicked(the mouse area overlays the .bmp) So far none of the rotate codes from the tutorial produce any movement in the bitmap when the mouse area is clicked. The code below, my most current failure, is written I think for a complete rotation of the .bmp. Ideally a 1/8 rotation is what I am shooting for. Can some one review my code and tell me where I am going wrong?


Code:
<Gauge Name="f4u1 aileron trim" Version="1.0">
   <Image Name="background1.bmp"/>
   <Element>
           <MaskImage Name="f117 pfd_attitude_card_mask.bmp">
               <Axis X="512" Y="512"/> 
           </MaskImage> 
               <Image Name="f117 pfd_attitude_card.bmp"> 
                 <Axis X="484" Y="500"/> 
               </Image>
           <Shift> 
                  <Value Minimum="-90" Maximum="90">(A:Attitude indicator pitch degrees, 
           degrees) /-/</Value> 
                  <Scale Y="4"/> 
           </Shift> 
           <Rotate>
                <Value>(A:Attitude indicator bank degrees, radians)</Value>
           </Rotate> 
 </Element>
<Element>
      <MaskImage Name="bank_indiktr_card_mask.bmp">
         <Axis X="454" Y="454"/>
      </MaskImage>
      <Image Name="bank_indiktr.bmp">
         <Axis X="360" Y="360"/>
      </Image>
      <Rotate>
         <Value>(A:Attitude indicator bank degrees,radians)</Value>
      </Rotate>
   </Element>
<Element>
      <MaskImage Name="bank_indiktr_card_mask.bmp">
         <Axis X="454" Y="454"/>
      </MaskImage>
      <Image Name="attitude_zero_bar.bmp">
         <Axis X="236" Y="19"/>
      </Image>
      <Shift>
         <Value Minimum="-90" Maximum="90">(A:Attitude bars position, degrees) /-/ </Value>
         <Scale Y="2"/>
      </Shift>
   </Element>
<Element>
      <Position X="876" Y="852"/>
      <Image Name="Attitude_Cage_Button.bmp">
         <Axis X="124" Y="123"/>
      </Image>
      <Rotate>
         <Value>(A:Attitude_Cage_Button)</Value>
         <Nonlinearity>
           <Item Value="0" X="752" Y="728"/>
           <Item Value="1" X="999" Y="728"/>
           <Item Value="2" X="999" Y="973"/>
           <Item Value="3" X="752" Y="973"/>
         </Nonlinearity>
      </Rotate>
   </Element>
<Element>
  <Position X="407" Y="912"/>
   <Image Name="postion_bar_ adj.bmp"/>
         <Axis X="51" Y="51"/>
   <Update Frequency="2"/>
   </Element>
    <Mouse>
      <Help ID="HELPID_GAUGE_ATTITUDE_INDICATOR"/>
      <Tooltip ID="TOOLTIPTEXT_ATTITUDE_INDICATOR_BANK_PITCH"/>
         <Area Left="407" Top="912" Width="101" Height="101">      
            <Tooltip>Left Click Attitude bar Up, right click Down</Tooltip>
           <Cursor Type="Hand"/>
           <Click Kind="LeftSingle+RightSingle" Repeat="Yes">
            (M:Event) 'LeftSingle' scmp 0 == 
           if{ (&gt;K:ATTITUDE_BARS_POSITION_UP) }
            (M:Event) 'RightSingle' scmp 0 == 
           if{ (&gt;K:ATTITUDE_BARS_POSITION_DOWN) }
         </Click>
         </Area>
         <Area Left="752" Top="729" Width="248" Height="246"> 
            <Tooltip>Left Click Toggles Cage Attitude</Tooltip>
           <Cursor Type="Hand"/>
           <Click Kind="LeftSingle" Repeat="Yes">
            (M:Event) 'LeftSingle' scmp 0 == 
           if{ (&gt;K:ATTITUDE_CAGE_BUTTON) }
         </Click>
        </Area>

Carl
 
You don't have any units in your A: variable:

<Value>(A:Attitude_Cage_Button)</Value>

Hope this helps,
 
I have tried <Value>(A:Attitude_Cage_Button, degrees)</Value> with no effect on the Attitude_Cage_Button.bmp.
I also tried a radians method: <Value>(A:Attitude_Cage_Button) 4 / 6.28318 *</Value> no movement with that one either.
I have tried all 3 of the tutorial's rotation methods and variations trying to get any kind of rotation with no luck. Given 3 different methods I can usually get some sort of reaction from one of them.
If not degrees or radians what other units are useable?

Hmmm!I was just looking over my code, all my functioning moment and rotational elements are under a masked area. Do I need to place a mask.bmp over the cage knob to allow it's rotation?

Carl
 
Hi,

Sometimes (being cautious though;)) it's a nice practice to check the SDK....

(A:Attitude_Cage_Button,unit) does not exists as a variable, the proper name is (A:Attitude Cage,bool) and reflects a logical condition whether the attitude is caged or not.
ATTITUDE_CAGE_BUTTON is the event that centers the ATT at 0 pitch and bank, which can be tested by inspecting (A:Attitude Cage,bool) state.
So, unless I'm missing something, I believe you should rethink that part of your code that contains <Image Name="Attitude_Cage_Button.bmp">.

Tom
 
Tom

I did read thru the SDK docs trying to find a fix. I must have missed it my work time is so limited now that spring has reached the northen hemisphere.

I have tried the<Value>(A:Attitude_Cage_Button, bool) as one of the variations, of course it did not work to rotate the bitmap.

I noticed last night that <Image Name="Attitude_Cage_Button.bmp"> was the only bitmap with upper case so I rewrote it with all lower case. I had originally named the bitmap, attitude_cage_knob.bmp the
Attitude_Cage_Button.bmp name was another variation I used trying to get some sort of rotation from the bitmap. Is the case issue what you are refering to?

I will try the new variable string and post results later.

Carl
 
Surely a bool is going to determine whether something is on or off, true or false, not the amount of rotation?
 
Carl,

If an A: variable does not exist in the SDK (or in a correction document), then you cannot use it, period. So give up on your using (A:Attitude_Cage_Button, bool) - it just won't work.

You could instead create a custom L: variable with the same name (L:Attitude_Cage_Button, degrees) (or a different name) and use that if you wish (but you must supply the value you want this variable to have).

Hope this helps,
 
Hi Guys!
taguilo had the best combination of code and the renaming of the.bmp suggestion helped too. The knob rotates about 1/8 rotation to cage and returns 1/8 rotation to the uncaged position.

If I leave the Nonlinearity section as it was the knob starts uncaged at -1/8 rotation then it rotates about a +1/8 rotation when clicked to cage and returns to the -1/8 rotation when clicked again.

Code:
 <Element>
      <Position X="876" Y="852"/>
      <Image Name="attitude_cage_knob.bmp">
         <Axis X="124" Y="123"/>
      </Image>
      <Rotate>
         <Value>(A:attitude cage, bool)</Value>
         <Nonlinearity>
           <Item Value="0" X="752" Y="728"/>
           <Item Value="1" X="999" Y="728"/>
           <Item Value="2" X="999" Y="973"/>
           <Item Value="3" X="752" Y="973"/>
         </Nonlinearity>
      </Rotate>
   </Element>

When I remove the Nonlinearity the knob starts uncaged at the correct location and rotates about 1/8 rotation. As hoped for.

Code:
<Element>
      <Position X="876" Y="852"/>
      <Image Name="attitude_cage_knob.bmp">
         <Axis X="124" Y="123"/>
      </Image>
      <Rotate>
         <Value>(A:attitude cage, bool)</Value>
      </Rotate>
   </Element>

hairyspin
I am a nubee at .xml code. While the tutorials I am working from have greatly expanded my knowlege base. I still do not fully grasp what every piece of code does. Thank you for the explanation of the bool.

tgibson
I had to write a few custom L: variable parts when doing my VC. I had not thought of using one in a gauge. Thank you for the suggestion.

Thank you all for helping me over these rough spots!

Carl
 
...If I leave the Nonlinearity section as it was the knob starts uncaged at -1/8 rotation then it rotates about a +1/8 rotation when clicked to cage and returns to the -1/8 rotation when clicked again.
When I remove the Nonlinearity the knob starts uncaged at the correct location and rotates about 1/8 rotation. As hoped for.

That was exactly what I expected from you to figure out when I suggested to "rethink that part of your code that contains <Image Name="Attitude_Cage_Button.bmp">" You thought it had something to do with the bitmap name but it hadn't, as caps don't have influence at all on bitmap's names (upper/lower is the same). I was refering to the entire <Element>, but I must admit maybe I didn't express it clear enough.

Tom
 
Tom

Hey with a hint and a swift kick in the seat of the pants I am usually able to figure out the codes, I may not always understand them but I am learning. I have a functioning 2d attitude gauge ready for my panel, my next task is the ball for the VC version of the gauge. I welcome any advice, tip, hint and or kick in the seat of the pants.

Carl
 
One idea, although I've never created one. When you animate the ball, you can have a small cube inside the ball tagged as forward/back, and linked to that is the ball, and it is tagged as right/left.
 
Tom

I figured something like that. My other choice is to write a VC version of the ball elements as a seperate 2d gauge and place it behind my gauge face part in the VC. It is good to have a back up plan.

Carl
 
Back
Top