Is 'Equal' of property sensor working?

Well, I’m really new with the game engine. I start working with the property sensor, and notice a bug (or me missing something). When I use ‘Equal’ for the property sensor, its never work, so I need to use ‘Interval’ instead, here are the files to show what I mean:

Interval (work)

Equal (doesn’t work)

Take a look at the logic brick of the camera.

Hope for some explanation :smiley:


is the property a float?


yup, there is your problem. Float variables are accurate to about .00000000000001, but not exactly. For example, 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 + 1.1 isn’t the same as 10 * 1.1

they are close, but not the same

therfore you should ALWAYS use the interval sensor on Float properties

this isn’t a problem with integer properties, but they don’t have decimal places, and many operations would round down. For example 3/2 = 1

When you are comparing “float” props, you have to use interval most of the time because they are never exactly on the integer value. It may say its 3.00, but actually in the computer it may be 3.000000000001. If you just want integer functionality (forgetting about the stuff after the decimal points) change your prop to “int”. Then when it’s 3 it will actually be 3 and not 3.00001.

Loud and clear :P, thanks alot! :smiley: