| Contents |
|
Next |
Bidirectional GUI connections make animating controls easy. The same pin that sends output when you move a Bitmap Image can move the Bitmap Image when you change the pin's value. In this example, we'll enhance the Joystick control prefab so that it responds to an external joystick. Let's take a look at the Joystick's structure again.
Its X- and Y-axis outputs range from -5 to +5. The Joystick Image's Animation Position is on a scale of 0 to 1.0, so our X- and Y-axis outputs will have to be scaled. We could use math modules and do the scaling ourselves, but we don't need to, because the Patch Mem - Float modules have already been set up to handle the scaling from the Animation Position to the prefab's output range, which is -5 to +5. (This was done by setting the Min Value and Max Value.)
Conveniently for us, the scaling works both ways, so if we
connect our Joystick In X- and Y-axis outputs to the Value pins of the Patch
Mem - Floats, their -5 to +5 range will be scaled to the 0 to 1.0 range
that's needed to drive the Animation Position correctly.
|
Next |