0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VRChatのCanvasでRay(青いビーム)が当たる範囲を制御する

Posted at

環境

  • Unity 2022.3.22f1
  • VRChat SDK - Base 3.6.1
  • VRChat SDK - Worlds 3.6.1

前提

  • CanvasにはVRC UI Shapeコンポーネントをつけましょう
  • CanvasのレイヤーはUIのままではなく、Pickupなどのレイヤーに変更しましょう

方法

下図のように、Canvasに非アクティブのBox Colliderをダミーでアタッチした後に、Rayが当たってほしい大きさの本物のBox Colliderを好きな個数アタッチします。
image.png


詳しい挙動を検証したわけではありませんが、VRC UI Shapeは自身がアタッチされたCanvasにBox Colliderが無い場合、scene再生時に勝手にCanvasと同じ大きさのBox Colliderを追加します。また、Box Colliderがあったとしても、勝手に大きさをCanvasと同じ大きさに変更します。

このVRC UI Shapeによる勝手なBox Colliderの操作を回避するために、非アクティブのBox Colliderをダミーで用意しておき、これをVRC UI Shapeに操作させます。(非アクティブなので勝手に操作されても関係ない)

サンプル

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?