How to add local rotation with integer in Blueprint?

Hi there, just think about all the games you play. Each one of them uses floats for everything. Every software on earth lives with this “bug” since it’s just about floating point precision of the CPUs.
Rotation will be calculated with float anyway no matter what you try to do :slight_smile:

If you want to use Integer you just make it worse for yourself since this is in fact the worst floating point precision :slight_smile:
No need to worry about floats. No one does. It only matters in scientific and math-heavy applications which you are probably are not going to create :slight_smile:

What you can do is to set the “Error Tolerance” when you compare Rotators (or Vectors). This is the “0.000100” Value you see in the node. You probably want to set it to 1 if you want to treat it as Integer. That solves the issues you think you will run into, but also can cause some others issues like ignoring smaller changes than 1.

Yep sure you can cast Integer to Float and Float to Integer if you need. Just Split the Rotator and plug the Integer value at the float pin, it will automatically create you the cast node. But be aware that you need to multiply your Input with DeltaSeconds to keep it framerate independent, so Integer is not useful in this case.

hth Marooney

In UE4, float value always resulted in non accurate decimal number. Example:
1 become 1.000001
2 become 2.000004
10 become 10.00014… and so on.
This is a known serious bug.

so how to add local rotation with integer value in Blueprint?

I wonder how they make calculator to counter this problem. Thanks for your explanation it helps a lot :slight_smile:

A float has 32bit of length, a double has 64bit of length , long double has 128bit for much bigger calculations. The longer the less error. But the longer the more cycles your CPU will need to process. If you got a 64bit system it can easily process 64bit doubles other than a 32bit system that would take longer. That is why you do not want to use bigger datatypes that will also use up more memory.
Sure games in C++ use double or longs instead of float if really required but BP just supports float for now, and this should be good enough unless you want to create an endless procedural world :slight_smile: