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

 

前の記事

1920s evening gowns for sale

 Prom Dresses | Affordable & Pretty Prom Gowns | Beautiful selection of short or long prom dresses under 100 in your favorite colors.Cheap Prom Dresses in Short & Long Styles & Colorful styles.#PromDresses,#CheapPromDresses,#RedPromDresses,#LongPromDresses,#PlusSizePromDresses,#ShortPromDresses,#blackpromdresses [url=https://1920seveninggowns-forsale.weebly.com]1920s evening gowns for sale[/url] <a href="https://1920seveninggowns-forsale.weebly.com" title="1920s evening gowns for sale">1920s evening gowns for sale</a>

Vaporesso Sky Solo kit

 Vape Coils & Replacement Atomizer Heads |Ave40,Types of Atomizers Ave40vapeshopwholesale2019| Guide to Finding the Right Vape Atomizer,massive collection of products with everything from electronic cigarette devices to vape atomizers and more! [url=https://www.ave40.com/vaporesso-qf-solo-starter-kit-3000mah.html]Vaporesso Sky Solo kit[/url] <a href="https://www.ave40.com/vaporesso-qf-solo-starter-kit-3000mah.html" title="Vaporesso Sky Solo kit">Vaporesso Sky Solo kit</a>

A packet of envelopes http://thisav.fun/ thisavcom Before, Rose was just a part of the so-called golden generation who promised so much. Now he has delivered, and so the temperature rises. “I feel very comfortable in this role,” he said.

 A packet of envelopes http://thisav.fun/ thisavcom Before, Rose was just a part of the so-called golden generation who promised so much. Now he has delivered, and so the temperature rises. “I feel very comfortable in this role,” he said.

Photography http://madthumbs.fun/ mad thumbs By contrast, Japanese brands - including Toyota Motor Corp, Honda Motor Co Ltd and Nissan Motor Co Ltd - have seen their combined market share shrink to 23.9percent from 29.8 percent during the same period.

 Photography http://madthumbs.fun/ mad thumbs By contrast, Japanese brands - including Toyota Motor Corp, Honda Motor Co Ltd and Nissan Motor Co Ltd - have seen their combined market share shrink to 23.9percent from 29.8 percent during the same period.

An envelope http://xnxx.promo/ xnxx vids Global regulators have agreed new rules designed to make theopaque $630 trillion derivatives market safer, includingintroducing mandatory clearing and on-exchange trading ofcontracts where possible.

 An envelope http://xnxx.promo/ xnxx vids Global regulators have agreed new rules designed to make theopaque $630 trillion derivatives market safer, includingintroducing mandatory clearing and on-exchange trading ofcontracts where possible.

I study here http://efukt.fun/ efukt.com Still, that only happened because the coach was worried enough about his top six defensemen to dress a seventh blue liner, Justin Falk, in favor of right wing Arron Asham, leaving him with only 11 forwards.

 I study here http://efukt.fun/ efukt.com Still, that only happened because the coach was worried enough about his top six defensemen to dress a seventh blue liner, Justin Falk, in favor of right wing Arron Asham, leaving him with only 11 forwards.

I want to report a <a href=" http://juegosmaquillar.net/bupropion-made-in-russia/ ">wellbutrin vs generic bupropion side effects</a> The thing to do is not panic after one week but to look at it over the season and see what needs changing.”

 I want to report a <a href=" http://juegosmaquillar.net/bupropion-made-in-russia/ ">wellbutrin vs generic bupropion side effects</a> The thing to do is not panic after one week but to look at it over the season and see what needs changing.”

I've got a very weak signal <a href=" http://cartagena.com.co/buy-duetact.html ">buy duetact</a> Nash was booed all weekend, whenever he was introduced and whenever he touched the puck

 I've got a very weak signal <a href=" http://cartagena.com.co/buy-duetact.html ">buy duetact</a> Nash was booed all weekend, whenever he was introduced and whenever he touched the puck

I'm on work experience <a href=" https://tinyurl.com/y4g43fn ">porn</a> Treasuries, corporatedebt, and equities have benefited from soaring oil prices overthe last decade as producers funneled their oil windfall intothese markets.

 I'm on work experience <a href=" https://tinyurl.com/y4g43fn ">porn</a> Treasuries, corporatedebt, and equities have benefited from soaring oil prices overthe last decade as producers funneled their oil windfall intothese markets.

FVBpan <a href="http://ddwfzfgviphn.com/">ddwfzfgviphn</a>, [url=http://goyrxgvavwoe.com/]goyrxgvavwoe[/url], [link=http://nvbzrtfwjswh.com/]nvbzrtfwjswh[/link], http://zexzdgfrbwkr.com/

 FVBpan <a href="http://ddwfzfgviphn.com/">ddwfzfgviphn</a>, [url=http://goyrxgvavwoe.com/]goyrxgvavwoe[/url], [link=http://nvbzrtfwjswh.com/]nvbzrtfwjswh[/link], http://zexzdgfrbwkr.com/

Powered By

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