I made a predefined dispersion pattern for shooting. I have two patterns triangle and quad.
And here is how the same logic works totally differently by making a log or without. There are no other changes, just this log. I don’t have an idea why the log so heavily affects the logic.
The logic works as intended for the triangle if the log is off, and for the quad if the log is on.
Triangle pattern - log on (1)
Try to store the rotation and the location value you get from the node on the left into a transform variable before calling the print string. And use the content of this stored variable to feed the print string as well as the Spawn Actor location/rotation.
This proably will make your problem go away, because in your code, Print string and Spawn Actor both trigger the execution of some part in your blueprint on the left (not visible in your screenshot), which most likely delivers different results when run again for the Spawn Actor.
See also my post here on blueprint strange effects that may happen due to the fact, that these are executed backwards.
I don’t know why precisely but we can explain this by understanding that if a node comes after another node, so node then arrow then node, it doesn’t mean that this will be calculated in game one after another. There are maybe thousands other hidden steps inserted by the engine between those nodes.
So because you are calculating a velocity, if you have a third node put in between the two single nodes I was mentioned, now there is even more stuff calculated between these nodes and that takes time and results may be different.
just to cut to the chase, found this the hard way, unreal engine is not linear in execution, especially when using blueprints, some stuff is calculated at different times and is not guaranteed you get the results when you want them and in the order you want them.
So it requires knowledge of the precise order of steps unreal does, when it will insert your blueprints and more precisely where your custom blueprint will end up in this execution order
This is a fascinating and deep rabbit hole.
anyway, physics are calculated at some point, print to log at other points. maybe this messes your code up
The observer effect in quantum mechanics is a fascinating concept, and it’s intriguing to see how it might apply in a programming context. Your approach of using a log to debug the different patterns is smart, but it’s puzzling why the presence of the log would affect the logic so significantly.
Overall, keep experimenting and debugging, and hopefully, you’ll uncover the reason behind this curious behavior. Check out quantumai.co for more insights into quantum mechanics and its applications in programming!