# 壁などの遮蔽物越しにUIを非表示にしたい

**URL:** <https://forums.unrealengine.com/t/ui/1988374>\
**Category:** 日本語 (Japanese)\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [August 23, 2024, 2:29am UTC](https://forums.unrealengine.com/t/ui/1988374 "2024-08-23T02:29:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANDY911217](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ANDY911217](https://forums.unrealengine.com/u/ANDY911217)\
**Post date:** [August 23, 2024, 2:29am UTC](https://forums.unrealengine.com/t/ui/1988374/1 "2024-08-23T02:29:58Z")

</div>

部屋ごとにアクタBP内のウィジェットコンポーネント(テクスチャ設定してる)を非表示にしたいのですがいい方法などありますでしょうか。

ご教授頂ければ幸いです。

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [August 23, 2024, 2:54am UTC](https://forums.unrealengine.com/t/ui/1988374/2 "2024-08-23T02:54:08Z")

</div>

I’m not sure i understand. But, you could try having an actor that has a ui widget component. So that the ui is in world space and gets occluded.  
Otherwise you could use a post process effect, and use the custom stencil channel.

以下のように日本語に翻訳しました:

よくわかりませんが、UIウィジェットコンポーネントを持つアクタを使うのはどうでしょうか。そうすれば、UIがワールド空間にあり、遮蔽されるようになります。

それ以外にも、ポストプロセスエフェクトを使い、カスタムステンシルチャンネルを利用する方法もあります。

---

<div class="post-metadata">

**Author:** ![ANDY911217](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ANDY911217](https://forums.unrealengine.com/u/ANDY911217)\
**Post date:** [August 23, 2024, 3:17am UTC](https://forums.unrealengine.com/t/ui/1988374/3 "2024-08-23T03:17:05Z")

</div>

**UIウィジェットコンポーネントを持つアクタを使うのはどうでしょうか。**  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/3/c/a3cfb577587b0d07853f40e03c74c960df8c9335.png)

↑アクタに追従するようにウィジェットを持たせています。これだと遮蔽されませんでした。

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [August 26, 2024, 9:26pm UTC](https://forums.unrealengine.com/t/ui/1988374/4 "2024-08-26T21:26:46Z")

</div>

do you have an example of what you want to achieve? and a picture of what is happening currently?  
is it a matter of just calling `SetVisibility` or `SetHiddenInGame` for the component?

Also have you tried playing around with the `Space` property of the widget component?  
In world space it should get occluded by other objects.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/8/7188291905fca121bb3c256868a37de963d2f7ec.png)

If you need a more complex effect, you can also take a look at the `Retainer` widget, inside the widget itself. But i think that is not what you are looking for.

はい、ご質問ありがとうございます。

ご要望の内容をより詳しく教えていただけますでしょうか?具体的にどのような効果を得たいのかの例があれば、より適切なアドバイスができると思います。また、現在の状況を示す画像があれば、問題の把握がしやすくなります。

単純に `SetVisibility` や `SetHiddenInGame` を呼び出せば、ウィジェットコンポーネントの表示/非表示を切り替えられると思います。また、ウィジェットコンポーネントの `Space` プロパティを「World Space」に設定すれば、他のオブジェクトに遮蔽されるようになるかもしれません。

より複雑な効果が必要な場合は、`Retainer` ウィジェットの活用も検討できます。ただし、それが求めているものではないかもしれません。

ご不明な点がありましたら、さらに詳しい情報をお聞かせください。できる限りサポートさせていただきます。

---

<div class="post-metadata">

**Author:** ![ANDY911217](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ANDY911217](https://forums.unrealengine.com/u/ANDY911217)\
**Post date:** [August 27, 2024, 12:31am UTC](https://forums.unrealengine.com/t/ui/1988374/5 "2024-08-27T00:31:05Z")

</div>

リビングのUIが隣の部屋に移動しても常に見えてしまっています。  
壁がある場合見えなくすることは可能でしょうか？

The living room UI is always visible even if I move to the next room.  
Is it possible to make it invisible if there is a wall?

---

<div class="post-metadata">

**Author:** ![nande](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nande/32/1057698_2.png) [@nande](https://forums.unrealengine.com/u/nande)\
**Post date:** [August 29, 2024, 9:56pm UTC](https://forums.unrealengine.com/t/ui/1988374/6 "2024-08-29T21:56:56Z")

</div>

I’m pretty confident that if you change the Widget Component’s “Space” to “World” it should get occluded correctly.  
The problem then will be that the Widget will not face the camera when you rotate around.  
The usual fix for this is to add some logic on the Widget “Actor” to update the rotation to face the camera. Usually on “Tick”.  
By the way, your scene looks beautiful.

Also note the alternative solution using “Was recently rendered”.  
You can keep the widget in “Screen” space. but you’ll need an extra component with “Cast shadows” set to off. Maybe a sphere collision or mesh is ok.

以下は、ご要求の内容を日本語に翻訳したものです:

ウィジェットコンポーネントの「Space」を「World」に変更すれば、正しくオクルージョンされるはずだと私は確信しています。  
その場合の問題は、ウィジェットがカメラの回転に合わせて向きを変えないことです。  
この問題の一般的な解決策は、ウィジェットの「Actor」にカメラに向かって回転を更新するロジックを追加することです。通常は「Tick」で行います。  
ところで、あなたのシーンはとてもきれいですね。

また、「最近レンダリングされた」を使った代替ソリューションにも注目してください。  
ウィジェットを「Screen」スペースのままにしておくことができます。ただし、「キャストシャドウ」をオフに設定した追加のコンポーネントが必要になります。スフィアコリジョンやメッシュでも構いません。

Please see this link:  
こちらのリンクをご覧ください:

> [@Widget component 'screen space' occlusion.](https://forums.unrealengine.com/t/widget-component-screen-space-occlusion/23449/7):
>
> When set to World guess you could always brute force the widgets scale relative to camera if you dont mind it clipping through actors: [WidgetBruteForce] [WidgetOccludedWorld] or when using Screen just turn it off when a specific component (with cast shadows set to false) has been occluded: [WidgetOccluded]

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 28, 2024, 9:57pm UTC](https://forums.unrealengine.com/t/ui/1988374/7 "2024-09-28T21:57:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
