Class VRInput
Namespace: Headjack
Fields
Back
VR Back button
Declaration
public static VRInput.VrButton Back
Field Value
Type | Description |
---|---|
VRInput.VrButton |
Remarks
Note
Escape key - Android back button - VR controller back button
Examples
void Update()
{
//Destroy videoplayer when "Back button" is pressed
if (VRInput.Back.Pressed)
{
App.DestroyVideoPlayer();
}
}
Confirm
VR Input button
Declaration
public static VRInput.VrButton Confirm
Field Value
Type | Description |
---|---|
VRInput.VrButton |
Remarks
Note
Left mouse button - Space - Screen tap - VR Controller trigger
Examples
public void CheckIfClickedOnMe()
{
if (App.IsCrosshairHit(gameObject))
{
if (VRInput.Confirm.Pressed)
{
print("Clicked on me!");
}
}
}
forceBackPressed
Declaration
public static bool forceBackPressed
Field Value
Type | Description |
---|---|
System.Boolean |
forceConfirmPressed
Declaration
public static bool forceConfirmPressed
Field Value
Type | Description |
---|---|
System.Boolean |
laserWorldSpace
Declaration
public static bool laserWorldSpace
Field Value
Type | Description |
---|---|
System.Boolean |
MotionControllerLaser
Show the laser of the motion controller
Declaration
public static bool MotionControllerLaser
Field Value
Type | Description |
---|---|
System.Boolean |
Examples
public void ShowLaserWhenHoldingTrigger()
{
if (VRInput.Confirm.Hold)
{
VRInput.MotionControllerLaser=true;
}else
{
VRInput.MotionControllerLaser=false;
}
}
remote
Holds metadata about currently used controller (e.g. handedness)
Declaration
public static VRInput.Remote remote
Field Value
Type | Description |
---|---|
VRInput.Remote |
Properties
LaserTransform
Get the transform of the motion controller laser (if available)
Declaration
public static Transform LaserTransform { get; }
Property Value
Type | Description |
---|---|
Transform |
Examples
public void GameObjectToLaserPosition(GameObject target)
{
target.transform.position = Headjack.VRInput.LaserTransform.position;
}
MotionControllerAvailable
Check if a motion controller is connected
Declaration
public static bool MotionControllerAvailable { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if a motion controller is connected |
MotionControllerColor
The color of the laser pointer, can be set or get
Declaration
public static Color MotionControllerColor { get; set; }
Property Value
Type | Description |
---|---|
Color | Current color of the motion controller laser |
MotionControllerShow
Show the motion controller, it will be glass/seethrough if false
Declaration
public static bool MotionControllerShow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Examples
public void ShowControllerWhenHoldingTrigger()
{
if (VRInput.Confirm.Hold)
{
VRInput.MotionControllerShow=true;
}else
{
VRInput.MotionControllerShow=false;
}
}