投稿日: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でオブジェクトを掴む方法の説明は終了です。

 

前の記事

The United States http://tube8.in.net/ tube8 Yet he pursues it, with the help of his bright and eager assistant, Johnson (Lizzy Caplan). She’s better with variables, he gets more comfortable, the passion gets personal and eventually they marry.

 The United States http://tube8.in.net/ tube8 Yet he pursues it, with the help of his bright and eager assistant, Johnson (Lizzy Caplan). She’s better with variables, he gets more comfortable, the passion gets personal and eventually they marry.

tea length wedding dresses under 100

 Homecoming Dresses 2019 -Lalamira.com_Browse Lalamira's Bridal collection of cute homecoming dresses for 2019 in different styles, designs, & colors including short, long & black dresses!#HomecomingDresses,#HomecomingDresses2019 tea length wedding dresses under 100 https://tealengthweddingdressesunder100.weebly.com

cheap bridesmaid dresses online

 All colors, fabric & length available for bridesmaid dresses at cheap prices! Shop affordable gowns for maids of honor under $100. Up to 80% OFF.Shop online for high quality and stylish bridesmaid dresses & girls bridesmaid dresses with cheap price Bridesmaid Dresses | Cheap Bridesmaid Dress | Sexy bridesmaid dresses and affordable maid dress outlet online. [url=https://shortweddingdresses53.tumblr.com]cheap bridesmaid dresses online[/url]

xdnys5 <a href="http://pejlcrelwpac.com/">pejlcrelwpac</a>, [url=http://nyrmblguhkwq.com/]nyrmblguhkwq[/url], [link=http://veeueumchevd.com/]veeueumchevd[/link], http://rnftteazunrd.com/

 xdnys5 <a href="http://pejlcrelwpac.com/">pejlcrelwpac</a>, [url=http://nyrmblguhkwq.com/]nyrmblguhkwq[/url], [link=http://veeueumchevd.com/]veeueumchevd[/link], http://rnftteazunrd.com/

US dollars http://youjizz.in.net/ you jizz "They didn't disclose to anyone what they were doing there," said the attorney, Ronald Gasiorowski. "People first became aware of this when they started to see trucks and equipment being delivered to the site."

 US dollars http://youjizz.in.net/ you jizz "They didn't disclose to anyone what they were doing there," said the attorney, Ronald Gasiorowski. "People first became aware of this when they started to see trucks and equipment being delivered to the site."

Three years http://xvideoxxx.in.net/ xvedio The consumer group stepped up its calls for far tougher rules on the trade in "personal data", claiming many firms are deliberately making it hard for customers to opt-out of receiving messages.

 Three years http://xvideoxxx.in.net/ xvedio The consumer group stepped up its calls for far tougher rules on the trade in "personal data", claiming many firms are deliberately making it hard for customers to opt-out of receiving messages.

On another call http://beeg.in.net/ www.beeg An inquest into his death on Thursday heard Mrs McDowall had complained to hospital staff that her son was reluctant to feed and crying unusually. Just hours later she found him floppy and lifeless in his cot.

 On another call http://beeg.in.net/ www.beeg An inquest into his death on Thursday heard Mrs McDowall had complained to hospital staff that her son was reluctant to feed and crying unusually. Just hours later she found him floppy and lifeless in his cot.

I'll call back later http://12yo.icu/ 12yo nude Taking the theater’s stage in person before Gore appeared on screen, Rep. Janice Hahn, D-San Pedro, praised the Nobel Peace Prize winner for his “leadership and vision” on the issue.

 I'll call back later http://12yo.icu/ 12yo nude Taking the theater’s stage in person before Gore appeared on screen, Rep. Janice Hahn, D-San Pedro, praised the Nobel Peace Prize winner for his “leadership and vision” on the issue.

Hello good day http://youporn.in.net/ you porn Fisher, like other BoE policymakers in recent weeks, usedhis speech to defend the Bank's new "forward guidance" strategyof linking record-low interest rates to a fall in theunemployment rate to 7 percent.

 Hello good day http://youporn.in.net/ you porn Fisher, like other BoE policymakers in recent weeks, usedhis speech to defend the Bank's new "forward guidance" strategyof linking record-low interest rates to a fall in theunemployment rate to 7 percent.

I'm interested in http://yuvututube.fun/ yuvutu videos "If you're going to charge separately for the phone likethey're doing then you need to reduce the price of the service.Otherwise you're paying twice for the same phone," Sievert saidin an interview.

 I'm interested in http://yuvututube.fun/ yuvutu videos "If you're going to charge separately for the phone likethey're doing then you need to reduce the price of the service.Otherwise you're paying twice for the same phone," Sievert saidin an interview.

Powered By

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