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

issue with wiper gauge button and adding gauges

Messages
160
Country
us-newyork
Hi , everyone. I pretty much finished the car that I was working on, with the tire animations and the glass. However, I am trying to get the wipers to work. I started experimenting by another code from another thread on here. However, I am trying to get the wipers to work. I started experimenting by using another code from another thread on here . The issue is when I press the switch, the mouse cursor changes to the hand but the wipers do not turn on in fsx. I included the code in both my xanim file to add i to the animation itself andafterwards, my modeldef.xml file to attempt to add the "Wiper_switch" and "Wiper_Anim" tag to see if both tags appear in my animation manager, and it does not. The only way the wipers move, is if i use the switch anti ice tag in the mouse rect attach tool and the animation tool for the wipers , but it only moves the wipers up if i press the "H" keyboard button once for up and once for down. Wiper_Switch only appears in the mouse rect tool , but wiper anim is no where to be seen. How can I make the wipers work? and here is the thread I am referencing. I attached the mdl, xanim and modeldef.xml files :

fsdeveloper.com/forum/threads/windshield-wiper-animation-tag.417509/

here are the objects (76 and 80) that I am trying to work on so that it activates when i press object named as "wiper_switch" in fsx.


code for switch:
<Animation name="Wiper_Switch" guid="C09CD82E-77CC-4082-926D-5F040D645B89" length="100" type="Sim" typeParam2="Wiper_Switch" typeParam="AutoPlay" />



<PartInfo>
<Name>Wiper_Switch</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:WIPER SWITCH,number)</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Wiper Switch %((L:WIPER SWITCH,number))%{case}%{:0}Off%{:50}Slow%{:100}Fast%{end}</TooltipText>
<MouseFlags>LeftSingle+LeftRelease+LeftDrag+WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmp 0 ==
if{ (M:X) (&gt;L:MOUSEPOS,number) quit }

(M:Event) 'LeftDrag' scmp 0 ==
if{ (M:X) (L:MOUSEPOS,number) - 0.2 * (L:WIPER SWITCH,number) + 0 max 100 min (&gt;L:WIPER SWITCH,number) (M:X) (&gt;L:MOUSEPOS,number) }

(M:Event) 'LeftRelease' scmp 0 ==
if{ (L:WIPER SWITCH,number) 25 &lt;
if{ 0 (&gt;L:WIPER SWITCH,number) }
25 75 (L:WIPER SWITCH,number) rng
if{ 50 (&gt;L:WIPER SWITCH,number) }
(L:WIPER SWITCH,number) 75 &gt;
if{ 100 (&gt;L:WIPER SWITCH,number) }
}

(M:Event) 'WheelUp' scmp 0 ==
if{ (L:WIPER SWITCH,number) 50 + 100 min (&gt;L:WIPER SWITCH,number) }

(M:Event) 'WheelDown' scmp 0 ==
if{ (L:WIPER SWITCH,number) 50 - 0 max (&gt;L:WIPER SWITCH,number) }

(L:WIPER SWITCH,number) 25 &lt;
if{ 0 (&gt;L:WIPER STATE,number) }

25 75 (L:WIPER SWITCH,number) rng
if{ 1 (&gt;L:WIPER STATE,number)
0.85 (&gt;L:WIPER SPEED,number) }

(L:WIPER SWITCH, number) 75 &gt;
if{ 1 (&gt;L:WIPER STATE,number)
2 (&gt;L:WIPER SPEED,number) }
</CallbackCode>
</MouseRect>
</PartInfo>

code for wipers:

<Animation name="Wiper_Anim" guid="E8CF768B-39AE-44f2-9F89-6F7F30DCD5AD" length="100" type="Sim" typeParam2="Wiper_Anim" typeParam="AutoPlay" />


<PartInfo>
<Name>Wiper_Anim</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(A:ELECTRICAL MASTER BATTERY,bool) 0 !=
if{ (L:WIPER STATE,number) 0 != (L:WIPER POS,number) 1 &gt; or
if{ (L:WIPER POS,number) (L:WIPER SPEED,number) 0.75 * + 100 % d (&gt;L:WIPER POS,number) } }
els{ (L:WIPER POS,number) }
</Code>
</Parameter>
</Animation>
</PartInfo>
 

Attachments

  • 1571391061739.png
    1571391061739.png
    248.6 KB · Views: 224
  • FordVan.rar
    4.3 MB · Views: 225

Heretic

Resource contributor
Messages
6,830
Country
germany
I have a hard time understanding what you want. And do not post code without using [code][/code] tags in here as it f-s up formatting. The link also doesn't work.

If you don't see new modeldef entries in the animation manager, you've either pasted them into the wrong modeldef or messed up formatting (check that all tags open and close properly).
Also generate a new GUID for every modeldef entry you add to minimize the chance for a duplicate.

Make sure your battery is on to see the wiper animation.
 
Messages
160
Country
us-newyork
Sorry. To be more clear, I want to know, how I can I program this to turn the wipers on by pressing the button? I did not know I had to do that to format the code. Here it is
Code:
 <Animation name="Wiper_Switch" guid="C09CD82E-77CC-4082-926D-5F040D645B89" length="100" type="Sim" typeParam2="Wiper_Switch" typeParam="AutoPlay" />



<PartInfo>
<Name>Wiper_Switch</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>(L:WIPER SWITCH,number)</Code>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Wiper Switch %((L:WIPER SWITCH,number))%{case}%{:0}Off%{:50}Slow%{:100}Fast%{end}</TooltipText>
<MouseFlags>LeftSingle+LeftRelease+LeftDrag+WheelUp+WheelDown</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmp 0 ==
if{ (M:X) (&gt;L:MOUSEPOS,number) quit }

(M:Event) 'LeftDrag' scmp 0 ==
if{ (M:X) (L:MOUSEPOS,number) - 0.2 * (L:WIPER SWITCH,number) + 0 max 100 min (&gt;L:WIPER SWITCH,number) (M:X) (&gt;L:MOUSEPOS,number) }

(M:Event) 'LeftRelease' scmp 0 ==
if{ (L:WIPER SWITCH,number) 25 &lt;
if{ 0 (&gt;L:WIPER SWITCH,number) }
25 75 (L:WIPER SWITCH,number) rng
if{ 50 (&gt;L:WIPER SWITCH,number) }
(L:WIPER SWITCH,number) 75 &gt;
if{ 100 (&gt;L:WIPER SWITCH,number) }
}

(M:Event) 'WheelUp' scmp 0 ==
if{ (L:WIPER SWITCH,number) 50 + 100 min (&gt;L:WIPER SWITCH,number) }

(M:Event) 'WheelDown' scmp 0 ==
if{ (L:WIPER SWITCH,number) 50 - 0 max (&gt;L:WIPER SWITCH,number) }

(L:WIPER SWITCH,number) 25 &lt;
if{ 0 (&gt;L:WIPER STATE,number) }

25 75 (L:WIPER SWITCH,number) rng
if{ 1 (&gt;L:WIPER STATE,number)
0.85 (&gt;L:WIPER SPEED,number) }

(L:WIPER SWITCH, number) 75 &gt;
if{ 1 (&gt;L:WIPER STATE,number)
2 (&gt;L:WIPER SPEED,number) }
</CallbackCode>
</MouseRect>
</PartInfo>

Code for wipers:

Code:
<Animation name="Wiper_Anim" guid="E8CF768B-39AE-44f2-9F89-6F7F30DCD5AD" length="100" type="Sim" typeParam2="Wiper_Anim" typeParam="AutoPlay" />


<PartInfo>
<Name>Wiper_Anim</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(A:ELECTRICAL MASTER BATTERY,bool) 0 !=
if{ (L:WIPER STATE,number) 0 != (L:WIPER POS,number) 1 &gt; or
if{ (L:WIPER POS,number) (L:WIPER SPEED,number) 0.75 * + 100 % d (&gt;L:WIPER POS,number) } }
els{ (L:WIPER POS,number) }
</Code>
</Parameter>
</Animation>
</PartInfo>

Here is the link to the thread I was referencing. I forgot to embed it: fsdeveloper.com/forum/threads/windshield-wiper-animation-tag.417509/
 
Messages
160
Country
us-newyork
I have a hard time understanding what you want. And do not post code without using [code][/code] tags in here as it f-s up formatting. The link also doesn't work.

If you don't see new modeldef entries in the animation manager, you've either pasted them into the wrong modeldef or messed up formatting (check that all tags open and close properly).
Also generate a new GUID for every modeldef entry you add to minimize the chance for a duplicate.

Make sure your battery is on to see the wiper animation.

One more question, how do I paste to the right modeldef? the one I pasted it to is located in the bin folder of the p3d sdk
 

Heretic

Resource contributor
Messages
6,830
Country
germany
One more question, how do I paste to the right modeldef? the one I pasted it to is located in the bin folder of the p3d sdk

In the FSX SDK, there were two modeldef files. One in the bin folder for the compiler and one in the plugin folder for 3DS Max for the Animation Manager, Attachpoint tool, etc.. I don't know if the P3D SDK did away with this rather confusing arrangement.

But I see now that somewhere in the block of text in the initial post, you've said that the mouserect tag for the wiper switch shows up, so the modeldef in "bin" must be the correct one. At this point, I can only suggest checking for duplicate GUIDs and double checking that you've pasted the animation code correctly.
 
Messages
160
Country
us-newyork
In the FSX SDK, there were two modeldef files. One in the bin folder for the compiler and one in the plugin folder for 3DS Max for the Animation Manager, Attachpoint tool, etc.. I don't know if the P3D SDK did away with this rather confusing arrangement.

But I see now that somewhere in the block of text in the initial post, you've said that the mouserect tag for the wiper switch shows up, so the modeldef in "bin" must be the correct one. At this point, I can only suggest checking for duplicate GUIDs and double checking that you've pasted the animation code correctly.

Thank you!! The wipers work! I was able to locate the animation for the switch and the wipers . They are 3 speed
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Thank you!! The wipers work! I was able to locate the animation for the switch and the wipers . They are 3 speed

Glad you got them working.

Any yes, three speed as stated in the code for the switch.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Just for information, the following is a very simple and working 2 speed wiper script:

XML:
  <Animation name="B350i_OVHD_WIPERS"             guid="3cb813d3-50e6-4874-9889-20ba2ddbbe2f" typeParam2="B350i_OVHD_WIPERS" length="20" type="Sim" typeParam="AutoPlay" />
  <Animation name="B350i_Wiper_Anim"              guid="E8CF768B-39AE-44f2-9F89-6F7F30DCD5AD" typeParam2="B350i_Wiper_Anim" length="100" type="Sim" typeParam="AutoPlay" />
 
   <PartInfo>
    <Name>B350i_Wiper_Anim</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:WIPER_POS,number)
        </Code>
      </Parameter>
    </Animation>
  </PartInfo>
 
    <PartInfo>
    <Name>B350i_OVHD_WIPERS</Name>
    <AnimLength>30</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          10 (L:WIPER_SPEED,enum) 10 * +
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle+RightSingle+Wheel+DownRepeat</MouseFlags>
      <CallbackCode>
        (L:WIPER_SPEED, enum) sp0
        (M:Event) 'LeftSingle' scmp 0 ==
        (M:Event) 'WheelDown' scmp 0 == or
        if{ (L:WIPER_SPEED, enum) -- -1 max d (>L:WIPER_SPEED, enum) }
        (M:Event) 'RightSingle' scmp 0 ==
        (M:Event) 'WheelUp' scmp 0 == or
        if{ (L:WIPER_SPEED, enum) ++ 2 min d (>L:WIPER_SPEED, enum) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>

The "driving logic" may be included in any XML gauge's <Update> section, although I generally have a separate "logic" gauge for this purpose:
XML:
    <!-- WIPER CONTROL LOGIC -->
    (A:ELECTRICAL MASTER BATTERY,bool) 0 !=
    if{ (L:WIPER_SPEED,number) 0 &gt;
    if{ (L:WIPER_POS, enum) 2 + 100 % (>L:WIPER_POS, enum) } }

    (L:WIPER_SPEED,number) -1 ==
    (L:WIPER_POS,number) 0 &gt; and
    if{ (L:WIPER_POS,number) -- (>L:WIPER_POS,number) }

    (L:WIPER_SPEED,number) -1 ==
    (L:WIPER_POS,number) 0 == and
    if{ 0 (>L:WIPER_SPEED,number) }
 
Messages
62
Country
france
Hello
I dont understand this:
The "driving logic" may be included in any XML gauge's <Update> section, although I generally have a separate "logic" gauge for this purpose:
XML:

<!-- WIPER CONTROL LOGIC -->
(A:ELECTRICAL MASTER BATTERY,bool) 0 !=
if{ (L:WIPER_SPEED,number) 0 &gt;
if{ (L:WIPER_POS, enum) 2 + 100 % (>L:WIPER_POS, enum) } }

(L:WIPER_SPEED,number) -1 ==
(L:WIPER_POS,number) 0 &gt; and
if{ (L:WIPER_POS,number) -- (>L:WIPER_POS,number) }

(L:WIPER_SPEED,number) -1 ==
(L:WIPER_POS,number) 0 == and
if{ 0 (>L:WIPER_SPEED,number) }


Where should I write this code?

Another thing, the line animation of the switch gives a length of 20 whereas the "part info" gives a length of 30.
Is this normal?

Thank you for your help

Best regards

Patrick
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Many authors prefer to put the logic into 2D gauge code, as Bill does above. The code he posted is a section of code that could be added to a master "logic gauge" - a transparent gauge added to a VC section of the panel.cfg file (which is read no matter what view you are in). This gauge could contain such sections from many different 3D gauges in an Update component. Or if you prefer it could be placed into a separate gauge (also placed into a VC section of the panel.cfg file) just for this 3D gauge alone.
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Hello
I dont understand this:
The "driving logic" may be included in any XML gauge's <Update> section, although I generally have a separate "logic" gauge for this purpose:

A "logic" gauge is an invisible panel gauge in the [VCockpitnn] section of the panel.cfg.

The advantage of such gauges is that they can very easily be altered. Logic controllers in the model (i.e. dummys or small boxes) require recompilation of the model after every change.
 
Messages
62
Country
france
Hello
Thank you for your answers. Everything is clear. These are the gauges we declare in the panel.cfg, but I prefer to define them with the 3D model if it is possible.
I'll post a little video to show you the result

Best regards
Patrick
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
A "logic" gauge is an invisible panel gauge in the [VCockpitnn] section of the panel.cfg.

The advantage of such gauges is that they can very easily be altered. Logic controllers in the model (i.e. dummys or small boxes) require recompilation of the model after every change.
Thank you two for answering the question. I had typed up a lovely and complete reply, but when I went to save it in my reply, the site 'froze' and would not post my reply... o_O
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Hello
Thank you for your answers. Everything is clear. These are the gauges we declare in the panel.cfg, but I prefer to define them with the 3D model if it is possible.
I'd still use an XML "gauge" at least until I had everything working properly, then moved the script to the modeldef.xml file when satisfied... :teacher:
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Thank you two for answering the question. I had typed up a lovely and complete reply, but when I went to save it in my reply, the site 'froze' and would not post my reply... o_O

Ah, this happens sometimes. I just wait it out or hit "reply" multiple times and hope for the best (and not many duplicates to clean up).
 
Top