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?
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.
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?
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.”