用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:clusterinput:clusterinput

ClusterInput 集群输入

class in UnityEngine

Description 描述

Interface for reading and writing inputs in a Unity Cluster.

在Unity中集群的读写输入的接口。

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.

ClusterInput通过连接VRPN服务提供访问VRPN设备列表。它还提供对可写输入的访问。所有输入由ClusterInput将被复制到集群中的其他连接的服务器。在unity中使用ClusterInput很像使用传统的输入系统。

JavaScript:

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

C#:

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 Functions静态函数

AddInputAdd a new VRPN input entry.
添加新的VRPN输入入口。
CheckConnectionToServerCheck the connection status of the device to the VRPN server it connected to.
检查设备的连接状态是否连接到VRPN服务器上。
EditInputEdit an input entry which added via ClusterInput.AddInput.
通过添加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.
设置该输入的自定义跟踪旋转。仅作用于自定义输入类型。
script/unityengine/classes/clusterinput/clusterinput.txt · 最后更改: 2016/08/02 05:35 (外部编辑)