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

[Suggestion] Allow snapping to other pieces #1

Open
Keklul404 opened this issue May 20, 2024 · 3 comments
Open

[Suggestion] Allow snapping to other pieces #1

Keklul404 opened this issue May 20, 2024 · 3 comments

Comments

@Keklul404
Copy link

Keklul404 commented May 20, 2024

Hi ! It would be great if we could have a button to change the snapping to the nearest pieces (like Fortify) instead of the grid.

The reason behind it is because triangle pieces does not fit correctly together due to the grid size, and thus, require manual moving for each of them (which is slow, but also seem to still leave a small gap even after manual repositioning).

After placing a second triangle foundation:
1111

After trying to manually move it into place:
22222

EDIT: I think one way to achieve that without being too complex or performance heavy would be to have a button that allow to switch between: free placing / grid snapping / pieces snapping, and for pieces, to check adjacent bounding boxes and automatically snap to it if the cursor is close enough.

@krystiandzirba
Copy link
Owner

krystiandzirba commented May 20, 2024

Hello!
Object snapping is definitely on the roadmap for this app, but I'm still considering the best approach to integrate it without causing any negative side effects.

The main challenge is the restricted browser environment itself. I'm concerned about the FPS when all the vertices of all objects (any rotations included) need to be stored and constantly checked for close intersections. That will definitely drop the performance, especially with large bases and I need to ensure the app remains accessible to users with low-end hardware.

As a temporary "solution", I've added a pivot control for objects. This tool allows users to manually drag objects without any restrictions (see pics below). I understand this isn't the ideal or fastest solution, but it's a placeholder until I can implement proper snapping.

Also, I like the idea of toggling between free placement, grid snapping, and piece snapping. This feature will certainly be added to the app aswell. Thanks for your feedback and support. <3

Edit: Additionally, I thought about adding an option for custom distance unit, allowing users to adjust it to their needs instead of being restricted to fixed values like x0.25, x1, and x5, that could temporarily help with the issue aswell.

image
image
image

@Keklul404
Copy link
Author

The main challenge is the restricted browser environment itself. I'm concerned about the FPS when all the vertices of all objects (any rotations included) need to be stored and constantly checked for close intersections. That will definitely drop the performance, especially with large bases and I need to ensure the app remains accessible to users with low-end hardware.

Yeah, I can understand that, 2 possible solution would be to:

  1. Making an "highlight" for the latest piece that was placed and only check for the "highlighted" piece. If the user want to continue on another part of the map, let him "highlight" a different piece and then continue the snapping from this. (Basically, snap (and thus check) only from 1 single "highlighted" piece)

  2. Using instanced meshes with cursor raycasting (like in Three.js), though, that's a lot of work, so I can understand that it's not so simple.

As a temporary "solution", I've added a pivot control for objects. This tool allows users to manually drag objects without any restrictions (see pics below). I understand this isn't the ideal or fastest solution, but it's a placeholder until I can implement proper snapping.

Nice, it's pretty good, and it's basically a "free placing".

Edit: Additionally, I thought about adding an option for custom distance unit, allowing users to adjust it to their needs instead of being restricted to fixed values like x0.25, x1, and x5, that could temporarily help with the issue aswell.

This was the solution I was about to experiment in the console log actually, I think this alone would fix the issue for now, it's even better than pivot since at least we can be sure to always be "perfect" position wise.

Adding a simple x0.01 would do trick, and then adding a custom one later would be perfect.

Thank you for your work.

@Keklul404
Copy link
Author

Nice, it works perfectly now.

image

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

No branches or pull requests

2 participants