Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector3.snapped gives incorrect result with negative values #6399

Closed
eon-s opened this issue Sep 5, 2016 · 0 comments
Closed

Vector3.snapped gives incorrect result with negative values #6399

eon-s opened this issue Sep 5, 2016 · 0 comments
Milestone

Comments

@eon-s
Copy link
Contributor

eon-s commented Sep 5, 2016

Operating system or device - Godot version:
Windows 7 64bit - Tested on Godot 2.03, 2.1 and current sources

Issue description (what happened, and what was expected):
What happened:
Vector3.snapped rounds to the higher number (less negative) instead of the closest to the given argument when the value is negative.

What was expected:
Same behavior/result as GDScript.stepify or Vector2.snapped (rounded to the closest number).

Steps to reproduce:
Running a script with the following lines:

    print("original      : ",Vector3(-9.8,9.8,0.6))
    print("V3 snapped: ",Vector3(-9.8,9.8,0.6).snapped(0.5))
    print("V2 snapped: ",Vector2(-9.8,9.8).snapped(Vector2(0.5,0.5)))
    print("stepify       : (",stepify(-9.8,0.5),", ",stepify(9.8,0.5),", ",stepify(0.6,0.5),")")

Gives as output:

original : (-9.8, 9.8, 0.6)
V3 snapped: (-9.5, 10, 0.5)
V2 snapped: (-10, 10)
stepify : (-10, 10, 0.5)

The second line has a wrong snapped x value.

Link to minimal example project (optional but very welcome):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants