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

P3D v4 Using a variable for FloatPosition doesn't seem to work...

Messages
57
Country
sweden
Instead of using literals like this
Code:
<FloatPosition>20.000, 40.000</FloatPosition>
I want to use
Code:
FloatPosition>(L:Xoff,number),(L:Yoff,number)</FloatPosition>
However, this is not positioning the element according to the values in the variables. Anyone know how to approach this?
 
Can't use variables in FloatPosition. Use <Shift><Scale><Expression>together with fixed number FloatPosition instead. The G1000 mfd gauge has examples.

Bob
 
Hi & thanks.

I looked at that earlier but it still requires that you actually specify float values in the non-linearity table. My variables are random offsets, and are set when the panel is opened and don't change until it is closed and opened again. No interpolation is required as this is not for an animation. The random offsets are meant to determine new coordinates to draw a line on a map at an position offset from the centre. Perhaps this is not possible in XML gauges. It would really help if I could find an explanation of all the properties of that tag.
 
Last edited:
Let's say I have a float position of 380, 380. I want to then add to these Xoff and Yoff. How would I do that using Shift? How do you specify x and y? I've tried a lot of stuff.
 
I've tried a lot of stuff.
but I don't think you looked at the G1000 mfd gauge, and it's written using FSX schema format which you will need to use.

You must use <Shift> to move objects in XML. Search this forum for "Shift" and you'll find lots of discussion, like this and this, which is written in FS9 schema format but you can figure out the FSX equivalent syntax.
 
It seems that in the FSX schema, the scale is a multiplier array for x and y, so <Scale>1.000, 0.000</Scale> means multiply x by 1, and y by 0. This effectively moves it in the x-axis. Similarly <Scale>0.000, 1.000</Scale> means multiply x by 0, and y by 1, with the result of moving it in the y-axis. So the general approach for moving something by an offset amount is:

Code:
            <Shift id="Shift">
                <Scale>1.000,0.000</Scale>
                    <Expression id="Expression">
                        <Script>(L:Xoffset,number)</Script>
                    </Expression>
            </Shift>
            <Shift id="Shift">
                <Scale>0.000,1.000</Scale>
                    <Expression id="Expression">
                        <Script>(L:Yoffset,number)</Script>
                    </Expression>
            </Shift>

This works.

However, I notice that this shifting takes place along the element's local coordinate system, as opposed to the coordinate system of the map. This is not a problem to correct unless the element gets rotated, which in my case it will be. I know I could use some trigonmetry to correct this, but that would be a complicated and messy fix. Do you know of a simpler way?
 
Last edited:
Almost. I had to put the <rotation> in the element parent, and the <shift> in child element that contains the <horizontalLine> object, which goes against intuition, but it was the one possibility I hadn't tried!

Thanks for help.
 
Last edited:
The suggestion was to put it in only one Element.

XML:
<Element>
    <Visibility> ... </Visibility>
    <FloatPosition>x,y</FloatPosition>
    <HorizontalLine>
        <Bright> ... </Bright>
        <Axis>x,y</Axis>
        <Width> ... </Width>
        <LineWidth> ... </LineWidth>
        <LineColor> ... </LineColor>
    </HorizontalLine>
    <Rotation><Expression><Script> ... </Script></Expression></Rotation>
    <Shift><Scale>1,0</Scale><Expression><Script>(L:YourVariableX)</Script></Expression></Shift>
    <Shift><Scale>0,1</Scale><Expression><Script>(L:YourVariableY)</Script></Expression></Shift>
</Element>
 
Thanks, without your help I wouldn't have solved this, but the only solution that worked for me was to put the rotation in the parent, and the shift in the child. I don't know why.

Anyway, I am approaching alpha stage with this gauge now, which is exciting. It's a map gauge which, when it opens, moves the centre to an offset random position so you don't know exactly where your aircraft is. If you tune into a VOR or NDB, it will draw a line across the map that intersects both the beacon and your aircraft. If you tune another VOR or NDB, it will draw its line so you can see where both lines intersect and know where you aircraft is. So the map simulates a navigator performing triangulation. I wanted to create something that I can use with older, pre-GPS aircraft. It will work with almost any aircraft but it was Just Flight's Boxcar that inspired it.
 
Last edited:
Back
Top