Version: 2022.1
LanguageEnglish
  • C#

ClusterInput

class in UnityEngine

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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.

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); } } }

Static Methods

AddInputAdd a new VRPN input entry.
CheckConnectionToServerCheck the connection status of the device to the VRPN server it connected to.
EditInputEdit an input entry which added via ClusterInput.AddInput.
GetAxisReturns the axis value as a continous float.
GetButtonReturns the binary value of a button.
GetTrackerPositionReturn the position of a tracker as a Vector3.
GetTrackerRotationReturns the rotation of a tracker as a Quaternion.
SetAxisSets the axis value for this input. Only works for input typed Custom.
SetButtonSets the button value for this input. Only works for input typed Custom.
SetTrackerPositionSets the tracker position for this input. Only works for input typed Custom.
SetTrackerRotationSets the tracker rotation for this input. Only works for input typed Custom.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961