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

■オブジェクトを掴むためのスクリプトの適用

前回の記事の続きです。

OculusTouchでオブジェクトを掴むための設定をしていきます。

 

 

まず、掴まれる側の設定です。ProjectビューのAssets->OVR->Scripts->Utilの中に、「Grabbable.cs」というファイルがあるので、これをHierarchyビューのCubeにドラッグします。掴まれる側の設定は、基本的にこれだけでOKです。

※「Grabbable.cs」は前々回の記事で「OVRGrabbable.cs」からリネームされています。

 

 

次に掴む側の設定です。まず掴む側の接触判定を作ります。HierarchyビューのLocalAvatarの直下に、空の子オブジェクトを追加します。名前は『Avatar Grab Sample』に従って、「grabber_left」とでもしてください。

 

 

次に、この「grabber_left」に接触判定のための物理演算を追加します。「grabber_left」のInspectorビュー、AddComponentから、Physics->RigidbodyとPhysics->CapsuleCliderを追加してください。RigidbodyはUseGravityのチェックを外して、IsKinematicのチェックを入れます。CapsuleCliderはIsTriggerのチェックを入れて、RadiusとHeightを『Avatar Grab Sample』に従って、それぞれ適当に0.02、0.1とでもしてください。

このCapsuleColiderが手の接触範囲となります。

 

 

そして最後に掴むためのスクリプトを設定します。ProjectビューのAssets->OVR->Scripts->Utilの中に、「Grabber.cs」というファイルがあるので、これをHierarchyビューの「grabber_left」にドラッグします。

※「Grabber.cs」は前々回の記事で「OVRGrabber.cs」からリネームされています。

 

 

「Grabber.cs」には3か所設定しないといけない場所があります。まず掴む手の位置です。とくに拘りがなければ手はデフォルトの位置で良いと思うので、HierarchyビューのLocalAvatarの子オブジェクトに「hand_left」という、左手位置のアンカー点があるので、これを「grabber_left」オブジェクトのInspectorビューのGrabberScript中のGripTransformという欄にドラッグします。

次に掴むアバターの設定。これはLocalAvatarになるので、Hierarchyビューの「LocalAvatar」を「grabber_left」オブジェクトのInspectorビューのGrabberScript中のAvatarという欄にドラッグします。

そして最後に操作するコントローラの設定。左手を設定しているので、「grabber_left」オブジェクトのInspectorビューのGrabberScript中のControllerという欄をL touchにします。

 

 

同じ要領で右手用の接触判定も作成してください。

これでOculusTouchでオブジェクトを掴むための設定はすべて完了です。

 

■シーンの実行

 

 

シーンを実行してみてください。『Avatar Grab Sample』と同様にCubeを掴めるはずです。もし掴みたいオブジェクトを追加したければ、掴みたいオブジェクトにRigidbody、適当なClider、Grabbable.csを設定すればOKです。

※オブジェクトの色が変化するのは、Grabbable.csに設定があります。該当するスクリプトをコメントアウトすれば色は変化しなくなります。

 

以上でOculusTouchでオブジェクトを掴む方法の説明は終了です。

 

前の記事

An estate agents http://xhamster-live.in.net/ xhamster milf "DoD regulations don't allow transgender individuals to serve in the U.S. military, based upon medical standards for military service," Pentagon spokesman Navy Lt. Cmdr. Nathan Christensen says.

 An estate agents http://xhamster-live.in.net/ xhamster milf "DoD regulations don't allow transgender individuals to serve in the U.S. military, based upon medical standards for military service," Pentagon spokesman Navy Lt. Cmdr. Nathan Christensen says.

A pension scheme http://xnxx.zone/ indian xnxx WEDNESDAY, Aug. 28 (HealthDay News) -- People with migraines -- either with or without an aura preceding the headache -- show changes in the structure of their brains on imaging tests, researchers say.

 A pension scheme http://xnxx.zone/ indian xnxx WEDNESDAY, Aug. 28 (HealthDay News) -- People with migraines -- either with or without an aura preceding the headache -- show changes in the structure of their brains on imaging tests, researchers say.

Cool site goodluck :) http://xxxxxxxx.in.net/ xxx tube * The Dow slipped and the S&P 500 edged up less than a pointon Wednesday, interrupting a four-day rally, with investorstrying to gauge when the Federal Reserve may scale back on itseconomic stimulus.

 Cool site goodluck :) http://xxxxxxxx.in.net/ xxx tube * The Dow slipped and the S&P 500 edged up less than a pointon Wednesday, interrupting a four-day rally, with investorstrying to gauge when the Federal Reserve may scale back on itseconomic stimulus.

History http://lamalinks.fun/ lamalink "We took it right to the death but unfortunately you're susceptible to that counter-attack where 3-1 - and I don't mean this as disrespect to Liverpool - flatters them a little bit.

 History http://lamalinks.fun/ lamalink "We took it right to the death but unfortunately you're susceptible to that counter-attack where 3-1 - and I don't mean this as disrespect to Liverpool - flatters them a little bit.

Remove card http://xxx-x.in.net/ xxx Luton Today provides news, events and sport features from the Luton area. For the best up to date information relating to Luton and the surrounding areas visit us at Luton Today regularly or bookmark this page.

 Remove card http://xxx-x.in.net/ xxx Luton Today provides news, events and sport features from the Luton area. For the best up to date information relating to Luton and the surrounding areas visit us at Luton Today regularly or bookmark this page.

I've got a part-time job http://levitra20.in.net/ levitra "This moment is not easy for me, is not easy for the cabinet ministers, and is not easy especially for the bereaved families, whose feelings I understand," Mr Netanyahu said ahead of the meeting.

 I've got a part-time job http://levitra20.in.net/ levitra "This moment is not easy for me, is not easy for the cabinet ministers, and is not easy especially for the bereaved families, whose feelings I understand," Mr Netanyahu said ahead of the meeting.

Jonny was here http://levitra20.in.net/ levitra generic Brodie Clarke, former head of the UK Border Force, said they had appealed for help from the public and registrars to report any suspicions as it was impossible for officers to police every case.

 Jonny was here http://levitra20.in.net/ levitra generic Brodie Clarke, former head of the UK Border Force, said they had appealed for help from the public and registrars to report any suspicions as it was impossible for officers to police every case.

I'm retired http://xnxx.in.net/ video xnxx NEW YORK, Oct 14 (Reuters) - U.S. stocks were down on Mondayon disappointment from investors that weekend talks did notresolve an impasse that threatens a possible U.S. default thatlooms three days away.

 I'm retired http://xnxx.in.net/ video xnxx NEW YORK, Oct 14 (Reuters) - U.S. stocks were down on Mondayon disappointment from investors that weekend talks did notresolve an impasse that threatens a possible U.S. default thatlooms three days away.

US dollars http://xnxx.in.net/ xnxx cina "For a sub several hundred mile journey, having a supersonic plane is rather pointless, as you would spend almost all your time slowly ascending and descending and very little time at cruise speed," he explained.

 US dollars http://xnxx.in.net/ xnxx cina "For a sub several hundred mile journey, having a supersonic plane is rather pointless, as you would spend almost all your time slowly ascending and descending and very little time at cruise speed," he explained.

US dollars http://genericvardenafil.in.net/ levitra However, please note - if you block/delete all cookies, some features of our websites, such as remembering your login details, or the site branding for your local newspaper may not function as a result.

 US dollars http://genericvardenafil.in.net/ levitra However, please note - if you block/delete all cookies, some features of our websites, such as remembering your login details, or the site branding for your local newspaper may not function as a result.

Powered By

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