# Doing vector math using the location of particles without converting from positions to vectors

**URL:** <https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931>\
**Category:** FX\
**Tags:** unreal-engine, question\
**Created:** [October 15, 2024, 5:44pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931 "2024-10-15T17:44:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TactileVisions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tactilevisions/32/1194626_2.png) [@TactileVisions](https://forums.unrealengine.com/u/TactileVisions)\
**Post date:** [October 15, 2024, 5:44pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/1 "2024-10-15T17:44:27Z")

</div>

I’m trying to use the location of particles for some calculations in Niagara, but in order to work with vectors it seems like I need to convert the “position” type to a “vector” type. This results in a warning: “Conversions between positions and vectors is a potentially unsafe operation”

Is there any other way to do vector math then? Or is this warning inevitable?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/0/8a0e9381eefdb6a5b38fd26765f1162cba71d8bf.png)

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [October 15, 2024, 5:57pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/2 "2024-10-15T17:57:00Z")

</div>

Hi,

Unless you’re working on a level that’s greater than 20km x 20km you won’t need to worry about the cast from doubles to float - the precision should be fine.

---

<div class="post-metadata">

**Author:** ![TactileVisions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tactilevisions/32/1194626_2.png) [@TactileVisions](https://forums.unrealengine.com/u/TactileVisions)\
**Post date:** [October 15, 2024, 6:52pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/3 "2024-10-15T18:52:10Z")

</div>

I might though. What do I do then?

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [October 15, 2024, 7:07pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/4 "2024-10-15T19:07:33Z")

</div>

Check out this video:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/0/1e009d8126e5794525614992cae1f6ba18b70aeb.jpeg "Particle Positions no longer Vectors - Large World Coordinates, LWC") ](https://www.youtube.com/watch?v=Q1KjXidNU6Q)

---

<div class="post-metadata">

**Author:** ![TactileVisions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tactilevisions/32/1194626_2.png) [@TactileVisions](https://forums.unrealengine.com/u/TactileVisions)\
**Post date:** [October 17, 2024, 2:27pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/5 "2024-10-17T14:27:29Z")

</div>

Thanks, that clarifies why it’s a position type and not a vector. But it doesn’t explain what you’re supposed to do if you want to do vector math on particles without converting and running into that warning.

Maybe I’m missing something basic here. For example, how would I calculate the distance between two particles without that conversion? Is there any way to do that without using particle position?

---

<div class="post-metadata">

**Author:** ![TactileVisions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tactilevisions/32/1194626_2.png) [@TactileVisions](https://forums.unrealengine.com/u/TactileVisions)\
**Post date:** [October 17, 2024, 3:16pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/6 "2024-10-17T15:16:25Z")

</div>

I received a reply from tharlevfx, the creator of the video above:

“so basically you would have to do the conversion. there’s an Add Vector to Position input so in your example you would convert the positions to vectors (ignoring the warning) to find the distance between them, then add that back to the original, unconverted Position.  
If the distances between the particles were very very large then you might get some conversion issues if you needed a very high level of accuracy - but that is quite an unlikely scenario to occur.”

I think that clarifies it

---

<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:** [November 16, 2024, 3:16pm UTC](https://forums.unrealengine.com/t/doing-vector-math-using-the-location-of-particles-without-converting-from-positions-to-vectors/2069931/7 "2024-11-16T15:16:34Z")

</div>

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