Version 17.5
This commit is contained in:
36
Profesor Atom/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs
Normal file
36
Profesor Atom/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
|
||||
//
|
||||
// Purpose: Helper to update poses when using native OpenVR integration.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using UnityEngine;
|
||||
using Valve.VR;
|
||||
|
||||
[RequireComponent(typeof(Camera))]
|
||||
public class SteamVR_UpdatePoses : MonoBehaviour
|
||||
{
|
||||
#if !(UNITY_5_6)
|
||||
void Awake()
|
||||
{
|
||||
var camera = GetComponent<Camera>();
|
||||
camera.stereoTargetEye = StereoTargetEyeMask.None;
|
||||
camera.clearFlags = CameraClearFlags.Nothing;
|
||||
camera.useOcclusionCulling = false;
|
||||
camera.cullingMask = 0;
|
||||
camera.depth = -9999;
|
||||
}
|
||||
#endif
|
||||
void OnPreCull()
|
||||
{
|
||||
var compositor = OpenVR.Compositor;
|
||||
if (compositor != null)
|
||||
{
|
||||
var render = SteamVR_Render.instance;
|
||||
compositor.GetLastPoses(render.poses, render.gamePoses);
|
||||
SteamVR_Events.NewPoses.Send(render.poses);
|
||||
SteamVR_Events.NewPosesApplied.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user