Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Draw tool does not snap to grid correctly #219

Open
jmickle66666666 opened this issue Jan 20, 2019 · 10 comments
Open

Draw tool does not snap to grid correctly #219

jmickle66666666 opened this issue Jan 20, 2019 · 10 comments

Comments

@jmickle66666666
Copy link
Contributor

sabredraw2

When using the Draw tool, it is snapping to the correct grid size, but not the global position of the grid properly. The Vertex tool and other tools match up with the projected grid perfectly but the draw tool doesn't.

@damagefilter
Copy link
Contributor

damagefilter commented Jan 21, 2019

It's because the tool tries to account for angled surfaces to attach cleanly to them.
It would snap the position in local space rather than the global grid.

Snapping the hit point to the global grid will cause hovering brushes on planes that are not on the grid.

Supposedly, one could work out a check for the surface normal we're attaching to and if it's a straight cardinal direction use a global snap, otherwise keep the local snap to prevent a brush from hovering.

Or alternatively throw away the clean attaching to angled surfaces when grid snapping is enabled and force it to the global grid at all times.

@jmickle66666666
Copy link
Contributor Author

The grid corners you can see on the gif are worldspace grid coordinates that exist on the plane, snapping to the global grid does not mean the points would float in space.

@jmickle66666666
Copy link
Contributor Author

At the very least it would be incredibly useful to be able to choose to switch between plane-grid and global grid when using the draw tool. Using the draw tool on angled surfaces without drawing on the world grid makes the resulting geometry really unwieldy.

@damagefilter
Copy link
Contributor

What I mean is, if we are to snap the vertex points when drawing to a global grid,
they will not attach to a plane that is not intersecting the grid, like here.
image

Of course, if that plane is intersecting the grid then there is no issue,
image

I suppose that's a bit too naive for snapping.
So I figured, perhaps we can find another approach.
Maybe only snap 2 components of the hitpoint vector.
Something along those lines ...

@jmickle66666666
Copy link
Contributor Author

Yeah that's basically what i'm getting at. I understand the current snapping logic but I think it's less useful (in my experience) than the 2 axes system the projected grid represents

@jmickle66666666
Copy link
Contributor Author

sabrecgrid
even on an axis-aligned surface the grid is offset

@damagefilter
Copy link
Contributor

damagefilter commented Jan 29, 2019

Yeah. I have noticed that too and fixed that bit for sure.

But the slopes ...
I had two versions.
One where it would be on-grid on slopes but would not attach to the surface.
(It would snap to points below or beneath the surfaces plane on odd angles, the usual))
One where it would attach to the surface but remain off-grid.

Can't seem to wrap my head around that part :C

Point being, I could drop some code and maybe 2 brains can do more than one?
Specifically if one of em is my brain. Ain't exactly fluid in maths. Hehe.

@Henry00IS
Copy link
Collaborator

@jmickle66666666 is currently working on adding concave shape support to the draw tool as well. You may wish to speak with her before you both end up accidentally fixing the same issue. 😁

@jmickle66666666
Copy link
Contributor Author

i actually managed to sort out the grid alignment stuff. i should take that out into a new branch first before doing the concave stuff, since that's gonna be more difficult

@damagefilter
Copy link
Contributor

Yes that's why I said the thing with the 2 brains, so we could perhaps look into that together.
Since @jmickle66666666 got a fix for it now though, I'm excited for how the solution looks like.

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

No branches or pull requests

3 participants