Introduction
In this article, we will describe how you can control Aximmetry with an Xbox controller.
Connection
Using Xbox controllers in Aximmetry does not require additional setup procedures besides connecting the controller to the PC that is running Aximmetry. The connection can be set up either wired or wirelessly.
Controlling Aximmetry with an Xbox Controller
You can assign an action to a control board button. E.g. let's assign one to the Play button on the CAMERAS panel. Xbox controllers belong to the Game category in Aximmetry. So right-click the Play button and choose Assign Game:
The Assign Game Controller dialog appears:
Simply press the desired button or move an analog stick on the controller to make the assignment.
If you select the menu File / Properties and then go to Game Assignments you'll see that the Controller button - Button 1 (A) in this example - is assigned to the Play button:
Similarly, you can assign an action to any logical or numeric properties of your scene modules by right-clicking on the property name:
Buttons or properties that you have assigned a controller input for are indicated by a mark in the lower left corner:
Camera Actions
Probably the most common usage of controllers is switching between cameras and camera paths. You can assign actions to CAM or Path selector buttons similar to how it was done with the Play button in our previous example, by right-clicking the desired button selecting Assign Game, and then pressing the desired button.
Controlling the Flow Graph
Using the Game Controller module you can implement an arbitrary control within the Flow graph.
The easiest way to assign an Xbox Controller action to the module is by turning its Learn property on:
Then simply press the desired button on the controller. The assignment is made by automatic filling of the Device and Controller properties. Also, the Learn switch is automatically turned off to prevent any accidental further assignments:
You can see that the aforementioned Button 1 is assigned to the module.
Another option is selecting a device and an action manually from the Device and Controller dropdown menus:
Here, the following bindings are selectable:
Left Stick axes - Axis 1 X and Axis 1 Y
Right Stick axes - Axis 2 X and Axis 2 Y
Triggers - Axis 1 Z (both triggers act on the same axis)
A - Button 1
X - Button 2
B - Button 3
Y - Button 4
LB - Button 5
RB - Button 6
Select - Button 7
Start - Button 8
Left Stick - Button 9
Right Stick - Button 10
The directional pad cannot be used in Aximmetry.
From now on pressing and releasing an assigned button will result in emitting 0 and 1 (by default) from the module. If you assign an axis, it will result in emitting the current value of the input continuously.
Please note that in the example above the Adjuster will only be active while the button is pressed. If you want an ON / OFF functionality instead use the Toggle module:
Separating Axis Values
You might notice that assigning an analog stick's axis or any of the triggers - both triggers act on the same axis - to a button or property does not allow you to select a direction of the said axis to be assigned, meaning that if you assign for example axis X to a button then both left and right will act on that button. It is possible to overcome this limitation by separating the axis values with logical modules like Greater or Less:
This way both directions of an axis can be interpreted as a button, you just need to use the logical modules' outputs instead of the Game Controller module's output.
When assigning an axis to a Control Board button or to a property by right-clicking on it, it is not possible to directly assign positive and negative values of the axis to that button or property. For this, you need to find the module, use the aforementioned method, and connect the modules manually.
This step is not required when assigning an axis to a scalar-type property, as the property is always set to the current value of the axis.
Axis Ranges
Defining the Min and Max Values of a Game Controller module pins works a bit differently than usual in the case of Xbox controller axes. Min Value represents the origin, where no input is applied, and Max Value represents the maximum value of the positive side of an axis - so the right side maximum value in the case of the X axis and downwards in the case of the Y axis. The difference between the Min and Max Value is the range of how much you can move away from the origin (Min Value).
This means that if you set the Min Value to 0 and Max Value to 2, you can have values from -2 to +2.
If you set Min Value to 4 and Max Value to 7, you can have values from 1 to 7, as the range is 3 (in both directions) from the origin of 4.
Furthermore, both triggers are handled as one axis. The left trigger moves the value into the positive side and the right trigger into the negative side.
Controlling Cameras
An Xbox Controller has analog sticks and triggers making it ideal for controlling cameras in a scene. For this purpose, we have already created the XBox_Camera_Control compound, found in the Common package. You can use this compound for moving, rotating, and zooming a Camera module.
To do this, you first need to set the Device on the Xbox_Camera_Control compound after importing it.:
The Camera Mover module is capable of moving a Camera module. You need to connect the Xbox_Camera_Control compound to a Camera Mover module in the following way:
After this, you just need to connect the Camera Mover to a Camera module that you would like to control with the Xbox controller:
Once everything is set, you can use your controller to control the camera in the following way:
- Left Stick: move horizontally
- Triggers: move vertically
- Right Stick: pan/tilt
- A / Y: zoom in/out
Keep in mind that the XBox_Camera_Control compound does not output a Focus value, therefore the Camera Mover's Focus Distance is not useful in our case.
Controlling the Camera in a Scene
Controlling the Camera in scenes requires modifying the camera compounds found in the Aximmetry library. You should avoid saving onto Aximmetry compounds as all your compounds where they are used would have the same (potentially unwanted) modification or a package update can overwrite your modifications.
Please make a copy of the Camera compound you wish to modify or use the unlinking feature instead. You can read about this here: Compound
Controlling Camera Paths
Controlling camera paths with an Xbox controller works the same way as in the previous example with the only difference being that you need to find the Camera Mover modules responsible for moving the Camera Path endpoints in the Camera compound.
The Camera Mover modules for setting the Camera Path endpoints can be found here:
Main Camera compound → INPUT # → VCam_xxx_Core
In the case of MixedCam compounds, their VirtualCam's Camera Mover modules can be found in the same place, however, finding their TrackedCam's Camera Mover modules includes an extra layer:
Main Camera compound → TrackedCam compound → INPUT # → VCam_xxx_Core
By clicking on the button, you can expand the Pin lists of the Camera Mover modules.
After this, you can connect the XBox_Camera_Control compound just like in the previous example:
You can connect it to all of the Camera Movers as one is set to an invalid channel when it is not in edit mode. This way, only the Camera Path currently being edited will be controlled.
Controlling Free Camera
Controlling the free camera with an Xbox controller works very similarly to how you would control the Camera Path endpoints. The only difference is that you need to find the Camera Mover module responsible for moving the free camera. This can be found at the highest layer of the Camera compounds, just by simply entering them. In the case of MixedCam compounds, the Camera Mover module of their VirtualCam's free camera can be found in the highest layer, and in the case of their TrackedCam, it can be found one layer lower, by entering their TrackedCam compound.
After finding the Camera Mover module, you just need to connect the XBox_Camera_Control compound in the same way as before: