投稿日:2017年10月09日  カテゴリー:VR  投稿者:SingularityMaster

■『Avatar Grab Sample』について

OculusTouchを使ったコンテンツを作成するにおいて、『Avatar Grab Sample』という非常に参考になるサンプルがあります。これはOculusの中の人ことmfmfさんが作ったサンプルです。

ただし、少々古いサンプルなので、Unity2017+OculusSDK1.16.0の環境において、いくつか修正しないといけない部分があります。この記事では、その修正とサンプルを使うところまで紹介します。

 

■『Avatar Grab Sample』の入手

まず、『Avatar Grab Sample』を入手します。『Avatar Grab Sample』はOculusDevelopersフォーラムのこちらでダウンロードできます。

 

 

ダウンロードしたらzipファイルを解凍して、中にある「AvatarGrabSample」というUnityPackegeFileを実行して、Unityにインポートしてください。実行する先は、前の記事までで作成してきたプロジェクトにお願いします(Unity2017+OculusUtilities1.16.0-beta + Oculus Avator SDK1.16.0 + Oculus Platform SDK1.16.0の環境)。

インポートが完了すると、Assets内にSamplesというフォルダができているはずです。

 

 

このSample->Contentフォルダ内にAvatarWithGrabというUnityファイルがあるのでこれを開きます。これがサンプルシーンなのですが、エラーが出て実行できないはずです。なのでまずバグを修正します。

 

■バグの修正(その1)

「Assets/OVR/Scripts/Util/OVRGrabber.cs(105,33): error CS1061: Type `OvrAvatarDriver' does not contain a definition for `GetCurrentPose' and no extension method `GetCurrentPose' of type `OvrAvatarDriver' could be found. Are you missing an assembly reference?」というエラーが発生しているはずです。

Unity2017+OculusSDK1.16.0環境下では、足りない定義があるのでそれを加えていきます。

 

 

Assets->OvrAvatar->Scriptsの中に、「OvrAvatarLocalDriver.cs」というスクリプトファイルがあるので、それを開きます。このスクリプト中の、40行目あたりに以下の定義一式を追加します。

 

    public bool MyGetCurrentPose(out PoseFrame pose)
    {
        pose = new PoseFrame
        {
            voiceAmplitude = voiceAmplitude,
            headPosition = UnityEngine.VR.InputTracking.GetLocalPosition(UnityEngine.VR.VRNode.CenterEye),
            headRotation = UnityEngine.VR.InputTracking.GetLocalRotation(UnityEngine.VR.VRNode.CenterEye),
            handLeftPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch),
            handLeftRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch),
            handRightPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch),
            handRightRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch),
            controllerLeftPose = GetControllerPose(OVRInput.Controller.LTouch),
            controllerRightPose = GetControllerPose(OVRInput.Controller.RTouch),
        };
        return true;
    }

 

次に、Assets->OVR->Scripts->Utilの中に「OVRGrabber.cs」というスクリプトファイルがあるので、それを開きます。このこのスクリプト中、105行目の

m_avatar.Driver.GetCurrentPose(out frame);

を削除して、

((OvrAvatarLocalDriver)m_avatar.Driver).MyGetCurrentPose(out frame);

に変更します。

 

■バグの修正(その2)

「The referenced script on this Behaviour is missing!」という警告がいっぱい出ているはずです。これは、このサンプルが作られた当初といくつかSDK内のファイル名が違っているのが原因です。

 

 

Assets->OVR->Scripts->Utilの中に、「OVRGrabber.cs」と「OVRGrabbable.cs」いうスクリプトファイルがあります。このファイルの名前のOVRを削除して、それぞれ「Grabber.cs」と「Grabbable.cs」というファイル名に変更します。

 

■バグの修正(その3)

エラーメッセージは表示されなくなりましたが、まだモノを掴むことができません。これは「Grabber.cs」にAvatarオブジェクトが設定されていないせいです。

 

 

HierarchyビューのLocalAvatar->grabber_leftオブジェクトを選択して、Inspectorビューを見ます。Grabberスクリプト中にAvatarという欄がありますが、そこに何も設定されてないはずです。

なので、Assets->OvrAvatar->Content->Orefabの中に、LacalAvatar.prefabというファイルがあるので、これをそのAvatar欄にドラッグして設定します。同様にして、grabber_rightオブジェクトにもLacalAvatar.prefabを設定します。

 

これで『Avatar Grab Sample』を正常に実行することができるはずです。ただし、まだ「No Oculus Rift App ID has been provided.」というエラーが出ていて気持ちが悪いのでこれも修正しておきます。

 

■OculusAppIDの取得、設定

「No Oculus Rift App ID has been provided.」を解決するためには、OculusAppIDを取得し、設定する必要があります。OculusDevelopersサイトのManageにアクセスしてください。このページの「Create New App」をクリックします。するとGearVRかOculusRiftかの選択肢が表示されるので、OculusRiftを選んでください。

 

 

次にアプリ名の入力画面が表示されるので、適当なアプリ名を入れて「Save and Continue」をクリックします。

 

 

次の画面に表示されるAppIDという欄の16桁の数字がOculusAppIDになります。これをコピーします。

 

 

Unityに戻って、ツールバー中の「OculusAvatars」をクリックします。Inspector画面にOculusRiftAppIDの入力欄が表示されるので、コピーしたIDをペーストします。

これでエラー表示はなくなるはずです。

 

■『Avatar Grab Sample』の実行

『Avatar Grab Sample』を実行してみましょう。

 

 

テーブルの上に並んだブロックを手で掴むことができるはずです。掴んだブロックを放り投げたり、他のブロックに衝突させることもできます。

これはOculusTouchを使ったコンテンツを作るうえで非常に参考となるサンプルです。これをベースに様々なコンテンツを作ることができます。これをテンプレートプロジェクトとして保存しておくと良いでしょう。

 

次の記事では、この『Avatar Grab Sample』を参考に、OculusTouchでオブジェクトを掴む方法を説明していきます。

 

前の記事 次の記事

I'm in a band http://xxxnx.fun/directporn/ xxnx Competitors will eye the performance of the plane's systemsand components, most notably its PurePower PW1500G turbofanengine by Pratt & Whitney, a unit of Connecticut-based UnitedTechnologies Corp..

 I'm in a band http://xxxnx.fun/directporn/ xxnx Competitors will eye the performance of the plane's systemsand components, most notably its PurePower PW1500G turbofanengine by Pratt & Whitney, a unit of Connecticut-based UnitedTechnologies Corp..

It's serious http://xxxnx.fun/gallerysex/ gallerysex Reep said the nation deserves a conversation about race. "However, our criminal justice system, where one man is taken on by an entire state, is not the forum for that — at least it should not be."

 It's serious http://xxxnx.fun/gallerysex/ gallerysex Reep said the nation deserves a conversation about race. "However, our criminal justice system, where one man is taken on by an entire state, is not the forum for that — at least it should not be."

Another year http://xxxnx.fun/shemaleporn/ shemaleporn Meanwhile Joe — an entrepreneur who has run everything from a stucco company to a pizzeria — failed to file tax returns for 2004 through 2008, when he is alleged to have earned nearly $1 million.

 Another year http://xxxnx.fun/shemaleporn/ shemaleporn Meanwhile Joe — an entrepreneur who has run everything from a stucco company to a pizzeria — failed to file tax returns for 2004 through 2008, when he is alleged to have earned nearly $1 million.

It's OK http://xxxnx.fun/sexyads/ netvideogirls The company's gene sequencing devices help read more than 3billion "letters" in the human genetic code which can help intracking food-related pathogens like salmonella outbreaks andother genetic disorders.

 It's OK http://xxxnx.fun/sexyads/ netvideogirls The company's gene sequencing devices help read more than 3billion "letters" in the human genetic code which can help intracking food-related pathogens like salmonella outbreaks andother genetic disorders.

I'm in a band http://xxxnx.fun/iseekgirls/ rubias19 Bonner said Joseph Michael Simpson, who was arrested Tuesday, was "never on our radar" until earlier this year, when a lab extracted "touch DNA" from the granite rocks used to crush the teen's skull.

 I'm in a band http://xxxnx.fun/iseekgirls/ rubias19 Bonner said Joseph Michael Simpson, who was arrested Tuesday, was "never on our radar" until earlier this year, when a lab extracted "touch DNA" from the granite rocks used to crush the teen's skull.

I don't like pubs http://xxxnx.fun/streamsexclips/ carneloka "It has to be tough for him, especially his only brother," Manning said. "His family is in our thoughts and prayers. After he told us, he was back to getting us ready for the football game."

 I don't like pubs http://xxxnx.fun/streamsexclips/ carneloka "It has to be tough for him, especially his only brother," Manning said. "His family is in our thoughts and prayers. After he told us, he was back to getting us ready for the football game."

On another call http://xxxnx.fun/backroommilf/ ppornhub But Willie Rennie, the Scottish Liberal Democrat leader, said he suspected the First Minister never intended to pay back the money until it became clear that the purchase would be made public.

 On another call http://xxxnx.fun/backroommilf/ ppornhub But Willie Rennie, the Scottish Liberal Democrat leader, said he suspected the First Minister never intended to pay back the money until it became clear that the purchase would be made public.

A few months http://fittor.top/eroreal/ filthyway Thomson Reuters, parent of Reuters which hascalculated Libor and distributed the rates on behalf of the BBAsince 2005, had also expressed an interest in a role in runningLibor, one of the sources said.

 A few months http://fittor.top/eroreal/ filthyway Thomson Reuters, parent of Reuters which hascalculated Libor and distributed the rates on behalf of the BBAsince 2005, had also expressed an interest in a role in runningLibor, one of the sources said.

I'm retired http://xnxxhd.site/ indian xnxx The homemade device exploded near the Kanz Ul Iman Masjid mosque in Tipton, West Midlands, shortly after 1pm – when up to 200 worshippers would normally have been in the area for Friday prayers.

 I'm retired http://xnxxhd.site/ indian xnxx The homemade device exploded near the Kanz Ul Iman Masjid mosque in Tipton, West Midlands, shortly after 1pm – when up to 200 worshippers would normally have been in the area for Friday prayers.

I enjoy travelling http://japanesexnxx.site/ xxnx "And also the fact that Mark has practiced well," Ryan told reporters Thursday afternoon, adding that Sanchez will play the first half with the starters. "That's really kind of what led to our decision."

 I enjoy travelling http://japanesexnxx.site/ xxnx "And also the fact that Mark has practiced well," Ryan told reporters Thursday afternoon, adding that Sanchez will play the first half with the starters. "That's really kind of what led to our decision."

Powered By

Copyright (C) 2017 テクノロジーカフェシンギュラリティ. All Rights Reserved.