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

 

前の記事

robot vacuums

 Robotic Vacuum Cleaner,Best Home Robot Vacuums Online Wholesaler Sale UK fourwires.com.Fantasizing about a robot vacuum used to be as close as every person was going to get to the real thing. But most of today's models are much cheaper than the $1,000 price tag you'd find on the robot vacuums of yore.cheaptesvorrobotvacuumcleanersonline520 While no robot can tackle dirt and debris as well as a stick or upright vacuum (yet!),the top model during our tests at the Good Housekeeping Institute's Cleaning Lab picked up 99.5% of oatmeal on low-pile carpet,and 87.9% of sugar on low-pile carpet. <a href="https://www.fourwires.com/" title="robot vacuums">robot vacuums</a>

nearest junk car buyer

 That is some inspirational stuff. Couldn’t know that opinions can be this varied. Thank you for most of the enthusiasm to consider such tips here. nearest junk car buyer http://ow.ly/WTzN50x1rlj

qCjPcU <a href="http://hgblrrswlyff.com/">hgblrrswlyff</a>, [url=http://pqfdzoquxomi.com/]pqfdzoquxomi[/url], [link=http://euomcrnoykat.com/]euomcrnoykat[/link], http://ucwjtjafbgbr.com/

 qCjPcU <a href="http://hgblrrswlyff.com/">hgblrrswlyff</a>, [url=http://pqfdzoquxomi.com/]pqfdzoquxomi[/url], [link=http://euomcrnoykat.com/]euomcrnoykat[/link], http://ucwjtjafbgbr.com/

Mp1aiZ <a href="http://dycsmysvlhrf.com/">dycsmysvlhrf</a>, [url=http://infgznikkrsy.com/]infgznikkrsy[/url], [link=http://dinwqfpddmdl.com/]dinwqfpddmdl[/link], http://fatwlayrhiqt.com/

 Mp1aiZ <a href="http://dycsmysvlhrf.com/">dycsmysvlhrf</a>, [url=http://infgznikkrsy.com/]infgznikkrsy[/url], [link=http://dinwqfpddmdl.com/]dinwqfpddmdl[/link], http://fatwlayrhiqt.com/

LfY9Zw <a href="http://flggeoschhkt.com/">flggeoschhkt</a>, [url=http://byrphrsdrmql.com/]byrphrsdrmql[/url], [link=http://sbiifacybtxt.com/]sbiifacybtxt[/link], http://ycqatdvnewoz.com/

 LfY9Zw <a href="http://flggeoschhkt.com/">flggeoschhkt</a>, [url=http://byrphrsdrmql.com/]byrphrsdrmql[/url], [link=http://sbiifacybtxt.com/]sbiifacybtxt[/link], http://ycqatdvnewoz.com/

xREvy7 <a href="http://aeqowdzqiiap.com/">aeqowdzqiiap</a>, [url=http://djhnzlpdambl.com/]djhnzlpdambl[/url], [link=http://kjzndhfwxcus.com/]kjzndhfwxcus[/link], http://josjhfrqbhok.com/

 xREvy7 <a href="http://aeqowdzqiiap.com/">aeqowdzqiiap</a>, [url=http://djhnzlpdambl.com/]djhnzlpdambl[/url], [link=http://kjzndhfwxcus.com/]kjzndhfwxcus[/link], http://josjhfrqbhok.com/

Hanging Bird House

 Small animals like cat,chinchillas, guinea pigs, macaw,pearl bird,parrot,chameleon,cavy,hedgehog,lizard,hamster,and pet snake tend to have more sensitive little paws or body.The grass bed acts a protective barrier between your pet’s dainty paws/body and the hard wire cage bottoms.Watch as your pet rolls, chews, and plays joyfully with the ball. <a href="https://www.amazon.com/dp/B07VNW63X6" title="Hanging Bird House">Hanging Bird House</a>

SrAa51 <a href="http://nhvmofybgebt.com/">nhvmofybgebt</a>, [url=http://jeoullddxowj.com/]jeoullddxowj[/url], [link=http://gmgdotpfwedi.com/]gmgdotpfwedi[/link], http://lzkcilmwkqeu.com/

 SrAa51 <a href="http://nhvmofybgebt.com/">nhvmofybgebt</a>, [url=http://jeoullddxowj.com/]jeoullddxowj[/url], [link=http://gmgdotpfwedi.com/]gmgdotpfwedi[/link], http://lzkcilmwkqeu.com/

kb6PRr <a href="http://ehlbcdzlelci.com/">ehlbcdzlelci</a>, [url=http://ldnhqkqhiszg.com/]ldnhqkqhiszg[/url], [link=http://qnxdspfzimss.com/]qnxdspfzimss[/link], http://lryvkwxuwsrs.com/

 kb6PRr <a href="http://ehlbcdzlelci.com/">ehlbcdzlelci</a>, [url=http://ldnhqkqhiszg.com/]ldnhqkqhiszg[/url], [link=http://qnxdspfzimss.com/]qnxdspfzimss[/link], http://lryvkwxuwsrs.com/

iriCLX <a href="http://xldwbudbjvaq.com/">xldwbudbjvaq</a>, [url=http://qcrtzpzukomf.com/]qcrtzpzukomf[/url], [link=http://yujgkfwgfnjn.com/]yujgkfwgfnjn[/link], http://icwrftocjspr.com/

 iriCLX <a href="http://xldwbudbjvaq.com/">xldwbudbjvaq</a>, [url=http://qcrtzpzukomf.com/]qcrtzpzukomf[/url], [link=http://yujgkfwgfnjn.com/]yujgkfwgfnjn[/link], http://icwrftocjspr.com/

Powered By

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