Skip to content

Instantly share code, notes, and snippets.

@cabbibo
Created February 25, 2016 23:25
Show Gist options
  • Save cabbibo/22cb53b6c4f4c557d326 to your computer and use it in GitHub Desktop.
Save cabbibo/22cb53b6c4f4c557d326 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using Valve.VR;
public class GetCollisionBounds : MonoBehaviour {
// Use this for initialization
void Start () {
var error = EVRInitError.None;
if (!SteamVR.active)
{
OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
if (error != EVRInitError.None){
return;
}
}
var pChaperone = OpenVR.GetGenericInterface(OpenVR.IVRChaperone_Version, ref error);
if (pChaperone == System.IntPtr.Zero || error != EVRInitError.None)
{
if (!SteamVR.active)
OpenVR.Shutdown();
return;
}
var chaperone = new CVRChaperone(pChaperone);
var chaperoneSetup = new CVRChaperoneSetup(pChaperone);
var pQuadsBuffer = new HmdQuad_t[20];
var bounds = chaperoneSetup.GetLiveCollisionBoundsInfo(ref pQuadsBuffer );
print( chaperone );
print( chaperoneSetup );
print( rect );
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment