Skip to content

Instantly share code, notes, and snippets.

@momo-the-monster
Created October 18, 2018 00:28
Show Gist options
  • Save momo-the-monster/5ba59be4e768624ad652f5e5e8348bee to your computer and use it in GitHub Desktop.
Save momo-the-monster/5ba59be4e768624ad652f5e5e8348bee to your computer and use it in GitHub Desktop.
Steam VR Interaction from Afar
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;
}
}
}
@momo-the-monster
Copy link
Author

Add to a hand, set the HoverSphere as the target. Bam! Interaction system from afar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment