How can this test be returning false negatives?
Pairs of compared vectors that are identical sometimes fail the test when they should be passing it. How can this be, and how do I fix this?
asked Jan 13 '16 at 02:19 AM in Blueprint Scripting
Vectors are floating point and VERY VERY precise (to 6-15 digits) so even the engine ticking and physics calculations make them != to eachother.
Split the vector struct (right click on it) and compare each axis (x,y,z or roll, pitch, yaw) with a nearly equal (float) node and use a tolerance to your likings.
Regards, Nsomnia -UnrealTek
answered Jan 13 '16 at 04:55 PM
Comparing float = float is unreliable, for instance, float1 can be 124.015455145 and float2 124.015455146.
You might want to use for this case a struct of Ints. Even something more reliable would be trigger boxes with Tags, so, entering on a trigger box you get its Tag and add to the visited blocks array and/or compare if the actor already has the Tag for that trigger box.
Follow this question
Once you sign in you will be able to subscribe for any updates here