# パーティクルで目的の場所まで線を伸ばしたい

**URL:** <https://forums.unrealengine.com/t/topic/470550>\
**Category:** FX\
**Tags:** unreal-engine, question\
**Created:** [August 30, 2020, 12:11pm UTC](https://forums.unrealengine.com/t/topic/470550 "2020-08-30T12:11:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![torano111](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@torano111](https://forums.unrealengine.com/u/torano111)\
**Post date:** [August 30, 2020, 12:11pm UTC](https://forums.unrealengine.com/t/topic/470550/1 "2020-08-30T12:11:00Z")

</div>

VRゲームで指先からWidgetInteractionのレイがヒットした場所まで線を描画したいと思っています。デバッグ目的ではなく、パッケージ時にも描画される線です。

3Dスペースに線を描画する方法いろいろ方法を探してみてビームパーティクルがいいみたいだとわかったので、以下のようにマテリアルとパーティクル、そしてVRプレイヤーの手を以下の画像のように設定しました。手アクターにMotionControllerComponentをつけ、その孫にParticleSystemComponent(ビームパーティクルをセットした以外はデフォルト)を置いています。

(マテリアルにつながっていない余計なノードがありますが無視してください。)

 ![311809-natsumatsurivr-unreal-editor-2020-08-30-20-44-49.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/0/730516bd765d4d1c1d5747adb1b65ed0bb2aaa71.jpeg)

 ![311810-natsumatsurivr-unreal-editor-2020-08-30-20-36-05.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/e/90e8615685330088f19515754608afd3eef776e6.png)

 ![311821-natsumatsurivr-unreal-editor-2020-08-30-20-36-14.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/5/8754f5cbf076037f14d0f4bfdd282b4f317cb1fd.png)

 ![311822-natsumatsurivr-unreal-editor-2020-08-30-20-35-06.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/5/9c5070b797eb61d62f8f2b47608e16516970fa27.png)

結果は以下のようになりました。

 ![311823-natsumatsurivr-preview-netmode-standalone-64-bit-w.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/6/c76d19a5f6be75f1f89a3f5fff7a077c25c0fda2.png)

青がパーティクル、赤がDrawDebugLineで描いたほうです。  
線の終点となるべき場所はDrawDebugSphereがある場所ですが、御覧のとおりそこまで伸びていません。

これを修正したいです。

修正のために試したこと

- パーティクルのTarget\>TargetMethodをUserSetにしてみた

- Activate/SetVisibilityの切り替え、または使わずにやった

- WidgetInteractionのLastHitResultでなく自前LineTraceの使用

- SetBeamTargetPointで渡す結果にWorld/Local両方の空間のポジションを渡してみた

- パーティクルをMotionControllerComponentの孫ではなく別のPawnアクターの子にしワールドポジションを渡してみた

- ImpactPointではなくLocationの使用

しかしうまくいきませんでした。どんな場合でもパーティクルの始点終点のローカル位置はほぼ変わっていないように見えます。画像であるように手を動かすと多少のずれはでますが、パーティクルの長さは変わりません。Pawnアクターの子にすると始点の位置も変わりません。  
GetBeamTargetPointで渡した位置の確認をしてみましたが、結果はtrueで正しい位置が返ってきます。  
このこととDrawDebugLineの結果をみるに渡しているポジションは正しいと思ったので、パーティクルの確認のために別に空アクターBlueprintを作成し、パーティクルコンポーネントをつけてTick事に少しずつ上昇する値を渡すと想定通りの結果=ビームが少しづつのびるようになりました。これでパーティクルが悪いわけではないみたいとわかったので、何が悪くて想定通りの動作をしないのかわからなくなりました。

よろしくお願いします。

---

<div class="post-metadata">

**Author:** ![torano111](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@torano111](https://forums.unrealengine.com/u/torano111)\
**Post date:** [August 30, 2020, 12:58pm UTC](https://forums.unrealengine.com/t/topic/470550/2 "2020-08-30T12:58:23Z")

</div>

自己解決できました。

> **[How do you set beam target and source outside the particle system?](https://forums.unrealengine.com/questions/263520/how-do-you-set-beam-target-and-source-outside-the.html)**
>
> I’m trying to setup a beam between two points in a blueprint, but am having no luck. Is it possible at all to set source and target pos outside of the particle system? I looked at the content examples and, while set to target mode, it still has a...
