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

 

前の記事

half homecoming dress

 Designer Evening Dresses | Cheap Evening Dresses Online | Evening Dresses for 2019 -_ [url=https://www.lalamira.com/f/half-homecoming-dress]half homecoming dress[/url] <a href="https://www.lalamira.com/f/half-homecoming-dress" title="half homecoming dress">half homecoming dress</a>

ijoy ai evo kit

 Ave40 offers top quality Vape Hardware, Vape Kits, Vape Tanks, Vape MODS, Coils, RDA's, E-Juices and Ave40vapeshopwholesale2019 Vape Accessories.Ave40 is your #1 source for Electronic Cigarettes. We're authorized distributors of all the top vape brands, Smok, Joyetech, Wismec, Innokin, Aspire, Suorin, Vaporesso and many more. [url=https://www.ave40.com/ijoy-ai-evo-pod-starter-kit-1100mah.html]ijoy ai evo kit[/url] <a href="https://www.ave40.com/ijoy-ai-evo-pod-starter-kit-1100mah.html" title="ijoy ai evo kit">ijoy ai evo kit</a>

vgod vape

 Ave40 are passionate about vaping! We build innovative vape devices including mods, tanks, vaping kits & tools.Ave40vapeshopwholesale2019 Browse our wide inventory of SMOK box mods, replacement vape coils, and vape tanks. Check out our huge selection of vapor cigarettes and find the best e-cig for your needs. [url=https://www.ave40.com/brands/vgod]vgod vape[/url] <a href="https://www.ave40.com/brands/vgod" title="vgod vape">vgod vape</a>

wholesale vape starter kit

 Smoktech, creator of Smok vape mods,tanks,starter kits and accessories.Ave40vapeshopwholesale2019 Find mods like the Smok Novo or tanks like the TFV12.Electronic Cigarettes Wholesale,Vape Wholesale and Distribution - Ave40. [url=https://www.ave40.com/starter-kits]wholesale vape starter kit[/url] <a href="https://www.ave40.com/starter-kits" title="wholesale vape starter kit">wholesale vape starter kit</a>

eleaf vape

 Vape Pens for Dry Herb, Concentrate and Liquid | Ave40,Don't miss out on the latest vape pen vaporizers on sale right now.Ave40vapeshopwholesale2019 Up your vaping game with our wide selection of best vape pens.Vaporizers - Best Portable Vaporizers - Vape Pens. [url=https://www.ave40.com/brands/eleaf]eleaf vape[/url] <a href="https://www.ave40.com/brands/eleaf" title="eleaf vape">eleaf vape</a>

long purple formal dress

 Designer Evening Dresses | Cheap Evening Dresses Online | Evening Dresses for 2019 -_Shop for cheap Evening Dresses? We have great 2019 Evening Dresses on sale.Buy cheap Evening Dresses online at lalamira.com today! [url=https://stunningeveninggownsaustralia6.weebly.com]long purple formal dress[/url] <a href="https://stunningeveninggownsaustralia6.weebly.com" title="long purple formal dress">long purple formal dress</a>

Do you like it here? <a href=" http://www.rumatoidarthritus.com/products-like-nizoral/#apple ">ketoconazole 200 mg tablets for dogs</a> But when they went to arrest her she had to go to the hospital for an unspecified medical problem.

 Do you like it here? <a href=" http://www.rumatoidarthritus.com/products-like-nizoral/#apple ">ketoconazole 200 mg tablets for dogs</a> But when they went to arrest her she had to go to the hospital for an unspecified medical problem.

What do you do? <a href=" http://www.hauntedhunters.com/sporanox-pulse-reviews/#sound ">purchase itraconazole sporanox</a> It also allows you to publish the videos for later viewing, which must mean that they will get bigger audiences

 What do you do? <a href=" http://www.hauntedhunters.com/sporanox-pulse-reviews/#sound ">purchase itraconazole sporanox</a> It also allows you to publish the videos for later viewing, which must mean that they will get bigger audiences

formal wedding guest dresses

 What is your bridal style? - #BridesmaidDresses,#CheapBridesmaidDresses,#BridesmaidDresses2019,#lalamiracom.With so many wedding dress styles to choose from, it's nearly impossible to know what style suits you best.#BridesmaidDresses,#CheapBridesmaidDresses,#BridesmaidDresses2019,#lalamiracom. [url=https://exactlytransparentlove.tumblr.com]formal wedding guest dresses[/url] <a href="https://exactlytransparentlove.tumblr.com" title="formal wedding guest dresses">formal wedding guest dresses</a>

cheap formal dresses 2019

 Looking for the perfect Cocktail Dress for an upcoming event? Browse our selection of trendy Cocktail Dresses. FREE SHIPPING on qualifying purchases!Cocktail Dresses & Party Dresses for Women | Perfect for any holiday party or cocktail hour, in styles like lace, sequin or off the shoulder.Cocktail Dresses For Women! [url=https://eveningdresseswithsleeves8.tumblr.com]cheap formal dresses 2019[/url] <a href="https://eveningdresseswithsleeves8.tumblr.com" title="cheap formal dresses 2019">cheap formal dresses 2019</a>

Powered By

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