A few of you here that have been nice enough to help me with this project know that I have been trying to learn UE for the past 3 or so months, and honestly, I love it. I’m not even a gamer, but I love the things you can do with the engine and all the applications for TV and cinema besides games.
And one of the things I love the most, and it has become somewhat of a game in itself for me, because I want to get better at it and conquer it, is the blueprint system. My brain is not wired for writing code, at best editing obvious tags in small HTML pages here and there. I just love connecting all these nodes and seeing what they do, and how they affect others, and how they are not always logical. And that’s my point for this post, because I want to understand the logic in this widget blueprint, and why it’s working in a reverse logical way.
This is a widget blueprint, with three images and a basic animation. It’s like nice motion graphic that says “Read More” when the player hovers over a frame in front of them at less than 500 whatever the measurement unit is, so in plain terms, something like 2 meters. That animation has to be triggered by a line trace, something that me and my team have used to oblivion in this project.
So here’s one version of it:
As you can see, in this one, I have used, after the line trace nodes, an “? is valid” and a branch node. But I bet when you looked at it for more than a second, you got drawn to the obvious blunder there. In the Is Valid node, I sent the wire to the branch out of the “Is not valid” output pin instead of the “is valid”. And then once again, I connected the “False” output from the branch to the play animation node.
So by looking at this, you would assume this doesn’t work. The point of the node flow is to tell the game that when the player is closer than 500 units to the actor, that if it’s valid that it hit the actor, then it will play the animation.
However, the way that makes sense, meaning, going from the “? Is valid” node’s “Is valid” output to the branch, and then from the “True” output of the branch, simple doesn’t work. In fact, I think when I doit the logical way, the animation plays when the player walks backwards out of the line trace area.
Then here’s another similar version of it:
As you can see, this one uses a Cast To the specific actor I chose, and when the cast with the line trace is successful, it should play the animation. Therefore, the Cast To node should go from the top nameless pin that assumes the line trace hit the actor, to the input of the play animation node.
But in the same way as above, it does not. It causes the opposite. However, when I do it the way you see here, going from “Cast failed” to the play animation node, in fact, does play the animation when the player hit the line trace area.
So this to me doesn’t make any sense, but is this a bug, or is there a logic here that I’m not following? Is it because of the specific type of blueprint? And I want to add, even though the first example doesn’t show as compiled, both of these compile with no issues, and don’t give me an “accessed none” error when I stop previewing the game.
So if someone can explain to me how this works it would be great. I tried all sorts of things to make sense of it, but I can’t.