Download

Ok, I'm curious. Is this undefined behavior?

I’m not sure whether I should post this here or in the Blueprint section. Please let me know if I should post it there instead.

My characters use planar movement. By default, movement is assumed to be perpendicular to the ground normal. I find it useful to use a public 2D vector to describe movement factors for the horizontal and vertical axes. From BP, relaying movement factors becomes a matter of doing the following:

https://forums.unrealengine.com/filedata/fetch?filedataid=177584&type=thumb&attachmentnodeid=

This is a trivial piece of BP code, yet it does not work for both axes simultaneously. Individually, yes, the components are updated properly, but if I run both, it only works “sometimes”. Sometimes only one axis will work, seemingly at random, sometimes both work and movement proceeds as planned, but changing the Blueprint anywhere else seems to affect this section. For instance, I changed a print call and it stopped working.

I wrote two C++ functions to set the factors individually, and they work as intended. I expected the Blueprint code above to be its equivalent, but apparently it isn’t.

This suggests a race condition to me. What am I missing?