Round Float To Next Integer

This doesn’t make any sense. Do you mean that round(-1.4) == -1 and round(-1.6) == -2?

It will be quite tricky to get it o round -1.4 to ZERO which is what you have written.

I’m going to assume that you mean -1 rather than 0.

And that is already the result you will get with both round and snapped.

extends Node

var a = -1.4
var b = -1.6

func _ready():
    prints(round(a), round(b))
    prints(snapped(a, 1), snapped(b, 1))

outputs:

-1 -2
-1 -2
2 Likes