NOT true is true?!

Hi!

New to Unreal, so I apologise for the silly question, but how can this be?

If you notice, “Is Swimming” is true, I am feeding it directly into a “NOT” node which is also returning true. I fully expected it to return false and I have no idea how this can be. Any ideas?

Thanks!

What the current code is checking: If the character is NOT falling and is NOT swimming it returns true. It could be that the Is Swimming node is not getting the correct data, or that you have set the default value to True.

Here is how an AND node works:

Input A Input B Output
0 0 0
0 1 0
1 0 0
1 1 1

You could do a slight “optimization”, remove the NOT nodes and use an NAND node instead.

Here is how a NAND node works:

Input A Input B Output
0 0 1
0 1 1
1 0 1
1 1 0
1 Like

Thanks, @EliasWick , but my question was more as to why the result of the NOT after IsSwimming is returning true when the value of IsSwimming is null.

If you look at my screenshot, I’m watching IsSwimming as well as the output of that particular NOT and both show “true” when I expected that with IsSwimming being true, the NOT straight after that should output “false”.

Essentially, what I thought I was writing here was:

shouldIK = (!isFalling && !isSwimming)

Absolutely, the code you wrote should be fine! However, there must be some issues in the code you have or are running. I can’t help you diagnose the code as the code you show isn’t where the issue is stemming from.

If you create a new project and setup a isSwimming variable, it would probably react differently unless there is an underlying bug.

Thanks - I’ve solved my issue a different way, by abstracting the decision to do IK or not to the Event Graph instead.

1 Like