When creating things like custom landing gear on rotators, you may now find yourself needing to set the min value to 0 and the max value to 1 so that the rotator works similar to before the update. This may involve swapping the min/max values and toggling the invert flag. When opening up an old plane file, the game should automatically do any conversions necessary to keep the same functionality as before. If set to 'output' the input controller uses the non-inverted input axis value, runs the min/max logic, and then inverts the output of the controller. The invert type of 'axis' works just like the old input controller did, where the axis input value is inverted and then the min/max logic runs. This affects the behavior of controller when 'invert' is set to 'true'. The default for most parts is 'axis' and the default for rotators is 'output'. The 'invertType' can be set to 'axis' or 'output'. The other change is the addition of the 'invertType' XML attribute. This allows those inputs to better take advantage of the min/max values of an input controller. Boolean inputs now return a value of -1 or 1 rather than the 0 or 1 that they used to. The 1.7 update introduces 2 important changes that you should be aware of when working with an InputController. ![]() If the 'invert' attribute is set to 'true' the the value of the input axis is inverted and then the same min/max logic applies.Įxample: input="Roll" min="-0.5" max="1" invert="false"Įxample: input="Roll" min="-0.5" max="1" invert="true"Įxample: input="LandingGear" min="-0.5" max="1" invert="false"Įxample: input="LandingGear" min="-0.5" max="1" invert="true" ![]() An input of zero will always return an output of 0. If the input axis is less than 0, the absolute value of the input axis value is multiplied by the controller 'min' value to get the final output value. If the value of an input axis is greater than 0, the input value is multiplied by the controller 'max' value to get the final output value of the input controller. Input controllers have a 'min' and a 'max' value. Prior to 1.7, those boolean type inputs would return an axis value of 0 or 1. This might be a normal axis like 'Roll' or 'VTOL' which returns a value anywhere from -1 to 1 or it might be a boolean type input that is either on or off like 'LandingGear' or 'FireWeapons'. The 'input' attribute defines the input axis associated with the controller. For the XML modders (and Overload mod users) out there that are familiar with it, there are a few changes to it in the 1.7 release that you may like to be aware of. For those of you unfamiliar with it, this post won't mean much to you. With this example you can clearly see how your potentiometer behaves and how you can use the 'weird' values from its readings in a useful way for your projects.Hey everyone! Lets chat a bit about the InputController. Serial.println(x) //post mapped value, println is a linebreak as wellĭelay(100) //so we don't post to much in the serial and you can read data better. Serial.print("\t") //a tab to make the reading more easy X = map(x, pMin, pMax, 0, 100) //take the value of x, compared it to the scale of the potentiometer pMin to pMax, and translate that value to the scale of 0 to 100 Serial.print(x) //prints the original reading X = analogRead(A0) //connect the potentiometer to the A0 pin of the Arduino ![]() Serial.begin(9600) //Serial monitor can be used to check the values ![]() Int x = 0 //we will use this value to store the readings of the potentiometer Int pMax = 948 //the highest value that comes out of the potentiometer. Let's get some example code: int pMin = 14 //the lowest value that comes out of the potentiometer What map() does is changing the value in a given scale, to that of another scale. So, you'll have to scale pMin and pMax to those values.įor this, you use the map() function. For example, what you want is pmin to be 0 and pMax to be 100.
0 Comments
Leave a Reply. |