Interface for reading and writing inputs in a Unity Cluster.
ClusterInput provides access to VRPN devices by connecting to a VRPN server. It also provides access to writeable inputs. All inputs managed by ClusterInput will be replicated to the rest of the connected slaves in the cluster. Using ClusterInput is much like using the traditional Input system in Unity.
#pragma strict function Update() { // Buttons and Axis provide a single value. var buttonValue: boolean = ClusterInput.GetButton("button1"); var axisValue: float = ClusterInput.GetAxis("axis1"); // A tracker provides 2 values, rotation and position. var position: Vector3 = ClusterInput.GetTrackerPosition("tracker1"); var rotation: Quaternion = ClusterInput.GetTrackerRotation("tracker1"); if (ClusterNetwork.isMasterOfCluster) { var axisValueCustom: float = MyCustomDevicePlugin.GetValue("myaxis"); ClusterInput.SetAxis("customAxis", axisValueCustom); } }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Update () { // Buttons and Axis provide a single value. bool buttonValue = ClusterInput.GetButton ("button1"); float axisValue = ClusterInput.GetAxis ("axis1");
// A tracker provides 2 values, rotation and position. Vector3 position = ClusterInput.GetTrackerPosition ("tracker1"); Quaternion rotation = ClusterInput.GetTrackerRotation ("tracker1");
if (ClusterNetwork.isMasterOfCluster ){ float axisValueCustom = MyCustomDevicePlugin.GetValue ("myaxis"); ClusterInput.SetAxis ("customAxis", axisValueCustom); } } }
AddInput | Add a new VRPN input entry. |
CheckConnectionToServer | Check the connection status of the device to the VRPN server it connected to. |
EditInput | Edit an input entry which added via ClusterInput.AddInput. |
GetAxis | Returns the axis value as a continous float. |
GetButton | Returns the binary value of a button. |
GetTrackerPosition | Return the position of a tracker as a Vector3. |
GetTrackerRotation | Returns the rotation of a tracker as a Quaternion. |
SetAxis | Sets the axis value for this input. Only works for input typed Custom. |
SetButton | Sets the button value for this input. Only works for input typed Custom. |
SetTrackerPosition | Sets the tracker position for this input. Only works for input typed Custom. |
SetTrackerRotation | Sets the tracker rotation for this input. Only works for input typed Custom. |