5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Unity 5.6.3 + SteamVR Plugin 1.2.3 でViveのコントローラが表示されない問題

Posted at

Unity 5.6.3 + SteamVR Plugin 1.2.3 でViveのコントローラが表示されない問題

Unity 2017を使えって話はさておき、これから何度もはまりそうなので忘備録です。

1.【SteamVR_UpdatePoses】を更新

deprecatedということで、コンポーネントを入れれない状態(DestroyImmediate(this)でAddした瞬間、自分を殺す状態)になってるのでソースを書き変え

SteamVR_UpdatePoses.cs
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Helper to update poses when using native OpenVR integration.
//
//=============================================================================

using UnityEngine;
using Valve.VR;

[ExecuteInEditMode]
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();
        }
    }
}

※SteamVR Plugin 1.2.0のパクリ

2.【Camera(eye)】に作成したコンポーネントを入れる

image.png

これでコントローラが表示されます

5
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?