-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Mouse move DPI on Input Events? (please change it to a better name!) #40579
Comments
Hey, I was looking to other examples of people implementing "draw" events, and I found a Demo with the same problem in the Templates tab of Godot window. The demo implements a simple paint editor, you can find it searching for Notice how the number of empty gaps increases as long as you increase the drag speed. |
Entirely expected, Godot does not simulate the traversal of the mouse from one point to another, as that would have undesired consequences for many applications. The solution, is to do it yourself. Remember the position of the mouse of the previous frame, then draw a line from there to its current position. Instead of only at its current positions. Mice teleport, they don't move gradually. This is caused by the speed at which the OS provides mouse information to Godot. Not necessarily related to frames rendered, but a faster system with unlocked main loop tick rate will perform better. |
Hey @TheDuriel ! So do you mean Godot editor actually implements this system you are talking when we draw in the editor? As I shared in my initial post, I don't have this problem when I'm drawing in the Godot editor. To be honest, I didn't quite get your idea of the algorithm, so I wanted to ask you if you could point me to some examples. Don't need to be in GDScript, any language would suffice, I just wasn't to understand the idea. |
The editor will likely be implementing it. In rough: Every Frame: |
What @TheDuriel describes is called Bresenham's line algorithm. It's already implemented in the TileMap editor but not in the GridMap editor yet. The current behavior works as designed, but we should find a place to document it. (None of this is specific to Godot, but it can still confuse people less familiar with input methods.) |
Thanks so much for the explanations @Calinou and @TheDuriel , you guys are doing an amazing work! |
This closes godotengine#40579. (cherry picked from commit 924b7ea)
This closes godotengine#40579. (cherry picked from commit 924b7ea)
Godot version:
v.3.2.1 Stable
OS/device including version:
Macbook Pro 2017 13'' default model (macOS Mojave)
Issue description:
I have configured a mouse event to paint a Tilemap.
However, depending on the speed of your mouse movement, you can see several gaps between the painted tiles.
The greater is the speed, the greater is the number of Gaps.
Here's a video showcasing the issue:
https://share.getcloudapp.com/P8ueB6Qg
Steps to reproduce:
Minimal reproduction project:
camera_drag_plus_set_tile.zip
Obs
Initially, I thought it was some issue with my mouse precision or something, but then I've noticed that when I'm painting in Tilemap with the Godot editor, I don't have this problem:
https://share.getcloudapp.com/mXuAePGZ
The text was updated successfully, but these errors were encountered: