Created
October 18, 2018 00:28
-
-
Save momo-the-monster/5ba59be4e768624ad652f5e5e8348bee to your computer and use it in GitHub Desktop.
Steam VR Interaction from Afar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Valve.VR; | |
public class RaycastHoverPoint : MonoBehaviour { | |
public LayerMask LayerMask; | |
public Transform target; | |
public float MaxDistance = 5; | |
public void OnPoseUpdate(SteamVR_Action_Pose pose) | |
{ | |
RaycastHit raycastHit; | |
if (Physics.Raycast(transform.position, transform.forward, out raycastHit, MaxDistance, LayerMask)) | |
{ | |
target.position = raycastHit.point; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add to a hand, set the HoverSphere as the target. Bam! Interaction system from afar.