1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Unity XR】XR Grab Interactableで掴む位置を変更する

Posted at

遮眼子が掴めない

image.png

なんとなくUnityを使って視力検査をしようと思い、上の画像のようなシーンを作ってみた。
うん、遮眼子ぎゃくぅ!
とりあえず、遮眼子を持てるようにしてみたのだが、持つ位置がおかしいし、向きも逆になっている(´;ω;`)

尚、Unityは2022.3.7f1を使っている。

掴めるようにする

掴む対象のオブジェクト(今回は遮眼子)にXR Grab Interactableを追加し、Smooth Position、Smooth Rotationにチェックを入れると、掴めるようになる。しかし、これだけだと前述のようにおかしな位置を握りしめることになった。

解決方法

image.png
空オブジェクト(AttachPoint)をローカル座標で掴みたい位置に設定し、これをXR Grab InteractableのAttachPointに設定すると、想定している持ち方ができた。
image.png

完成

image.png
無事に遮眼子を手で持って視力検査ができるようになった。VRで視力検査をする意味は特にない...

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?