x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Branch node doesn't return correct value

So I'm doing my first Match game and the logic I use to define what to spawn when matching two actors is taking a Float Variable from each actor and adding them together. This works as intended for every match except the first one (2.3) and even though I'm debugging with Print String to verify that I get the result 2.3 it will still just return everything False (and thus not spawning anything)

Can anyone think of something I'm doing wrong? I tried simply switching the True and False Execs but that just makes EVERYTHING to turn into the object intended for 2.3 :p I also tried putting the first Branch node in the "bottom of the stack" but that just returned the same problem.

alt text

Product Version: UE 4.12
Tags:
bug1.png (178.5 kB)
more ▼

asked Jun 29 '16 at 11:38 AM in Blueprint Scripting

avatar image

Fred82
78 3 3 10

avatar image rjvm Jun 29 '16 at 11:50 AM

I do not understand What do you want to do?

spawn diferent ators when you put the diferents values in the float ?

avatar image Fred82 Jun 29 '16 at 11:54 AM

I want the Branch node to accept that in this case (1.1 + 1.2) == 2.3 It's not too much to ask for considering that the other Branch nodes accepts that (1.1 + 1.3) == 2.4 and (1.2 + 1.3) == 2.5

avatar image rjvm Jun 29 '16 at 11:56 AM

ok i make a video for you wait a moment pls what version of unreal you use ?

avatar image Fred82 Jun 29 '16 at 11:58 AM

4.12 I'll make a video when I come home, but what happens is that the Branch node doesn't accept the value == 2.3 even though I've used print string to debug and verify that the value is in fact 2.3. 2.4 and 2.5 returns just fine.

avatar image rjvm Jun 29 '16 at 12:35 PM

if you're right no show me the 2.3 if you use the == but you can use the >= the == have a problem with that number. alt text

answerhud.png (413.7 kB)
avatar image rjvm Jun 29 '16 at 12:39 PM

alt text

answerhud2.png (809.8 kB)
avatar image Fred82 Jun 29 '16 at 02:30 PM

Thanks for testing it rjvm but my issue remains. However I had an idea for re-working my system to what I think is a better solution so I'll just close this issue. It's still a very weird problem though.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You are likely running into floating point round off errors. They don't happen as often when simply adding two float's, but can still happen sometimes.

When you perform math operations on multiple float values you will sometimes get a value that is almost, but not exactly the value you want.

In this case 1.2 + 2.1 could potentially return 2.300001 (example only). The reason for this is float's only have about 6 decimal places worth of precision before they start running into round off errors. The precision is good enough for most uses in a game engine, but using them in a math equation will not always produce the exact value you are looking for.

For that reason you should try to avoid using the "float == float" node, there is no way to guarantee it will be equal. You should use less/greater than or equals, or even two integers (one for the whole number, the other for the remainder) instead to ensure it's accurate.

Hope that helps,

DC

more ▼

answered Jun 30 '16 at 11:46 AM

avatar image

DotCam
3.1k 74 34 148

avatar image Fred82 Jun 30 '16 at 11:50 AM

Thanks! I had no idea about this :) I'll have to be more careful around computer math

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question