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

Between contition for animated windsock

Messages
767
Country
italy
Hi!.
First of all I would like to thank you again for your usefull help. This site and this forum is like founding a goldmine!
I'm near the last step into creating my first "well made" scenery: adding a good animated windsock is still a problem without vertex animation, but I got decent results.
Now it's time to get it rotating according to wind direction.
So I've made a set of windsocks mdls pointing 0-60-120-180-240-300° (for both low-mid and high speed wind)
I ran MDLTweaker II (what a wonderful tool!) and put wind velocity conditions: ok, they behave quite correctly.
Next step is to add wind heading condition. The little help says I must use 0 to 65535 value for 0 to 360 degrees. But, if I write a number > 32767 in the box the program give me "Overflow" runtime error. (only 16 bit values admitted?)
I tried with negative values (0 to 32767, -32767 to -1) but I'm not sure this is the right way. For example, using the following table, for the 120° mdl I wrote min 16384 and max 27306, and for the 360 (0) mdl I wrote min -5461 and max 5461
Code:
Values are obtained using the formula (Degree * 65535)/360
Value' is the "should be" range from 0 to 65535
Value'' are range from -32767 to 32767 


Degrees	Value'	Value''
0	-	-
30	5461	5461
60	-	-
90	16384	16384
120	-	-
150	27306	27306
180	-	-
210	38229	-27306
240	-	-
270	49151	-16384
300	-	-
330	60074	-5461
360	-	-

Now my windsock is animated, rotates accordingly to the wind, has different model for no wind, low-mid wind and high wind BUT it requires a full restart of FS to see changes... Where is the trick?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

Yes, the way you handle the negative values looks correct. That error is a good one, I did not think about that before. The code does not know if you are using signed or unsigned values and that makes a difference when trying to write back into the object. I'll try to prevent that error in the future.

The problem you mention with the objects not responding is also a common one. Objects that interact with the wind only work if you have placed at least two of them on your screen. And those two objects must not be at exactly the same location. So you might want to add another windsock somewhere else (maybe hidden in a building or so).
 
Messages
767
Country
italy
I have already two windsocks at both runway ends :) .

I've noticed, however, that the "bug" disappears if I look away from the object after changing weather. It is not so cool..but, it works, so, I'm quite happy :D
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
If at least two of the objects are on your screen (not in the scenery) at the same time, it should work right away. But this is indeed a bit of a tricky bug to work with.
 
Messages
55
Country
malta
Hi all,
i'm having a similar problem here, in displaying an object according to wind direction. I did manage to get the object to be displayed when the wind is between 0 to 179 degrees, however beyond that, the object doesn't get displayed anymore.
For example if I want an object to be displayed between 090-150 is used the values (min)16384 - (max)27306 and that worked fine.
Beyond 180 degrees I tried using the negative value idea as mentioned here, since I also got the overflow error. So, if I wanted the object to be displayed when the wind is between 090-270 I used (min)16384 - (max)-16384.
However in this case the object never got displayed. What could be the problem?

Thanks
Daniel
 
Messages
767
Country
italy
it's quite simple: with values like (min)16384 - (max)-16384 you are going counterclockwise, wich is not good.
In order to have your object displayed correctly, your condition should be:

(min)16384 - (max) 32767
OR
(min)-32767 - (max) - 16384

This
mamu said:
(0 to 32767, -32767 to -1)

means: values are from -32767 to 32767 (180° to 180° clockwise)
 
Messages
55
Country
malta
Thanks for the explanation Mamu, i did get part of what I want working, but I'm still having difficulty with another situation.

First of all I did manage to get the object to appear beyond the 180degree threshold. I wanted an object to appear between a wind direction of 250-070 with values (min-20024) - (max12743) and it works correct now.

However how about if i want another object to appear between the 070-250 zone? I can't start the value with a minus (ie -12743) coz that would mean a wind direction of 290. If I start with a postive going to a negative it would be anti-clockwise.
So in my case do i have to split it up in to 2 parts? IE from 070 - 180 (using a positive value) and 180 - 250 (using a negative value). At the moment it seems the only way out.

Thanks
Daniel
 
Messages
767
Country
italy
So in my case do i have to split it up in to 2 parts? IE from 070 - 180 (using a positive value) and 180 - 250 (using a negative value). At the moment it seems the only way out.

Thanks
Daniel
That is the way I got it working :). With MDLTweaker you can't add condition linked with AND and the OR logical operator at the same time. So, if you have to check wind speed AND wind direction, you must use 2 different object (well, the same object tweaked into different ways). Otherwise, if you don't care about wind speed, then you can link you conditions with OR logical operator (please see the following steps):

1- open the object 070-250 width MDLTweaker II
2- click Add object condition
3- select the variable Wind direction from the variable dropdown list
4- use (min)16384, (max) 32767
5- click new condition
6- select the logical operator OR in the new dropdown list that is appeared
7- select the variable Wind direction from the variable dropdown list
8- use (min)-32767, (max) - 16384
9- click apply to object and save
10- it must be working :)

Hope this helps!
 
Top