- Home /
infinite 2d grid in an Editor Window
Having trouble with what should be a trivial problem. I have a 10x10 grid rendered into an EditorWindow via GL. I can scroll the grid infinitely and i can zoom it infinitely by multiplying the underlying cells by x2 and wrapping that zoomfactor so it loops back to 1. If i keep the grid at my 'scrolled' origin then it all works great.
If i 'scroll' the grid, the cells 'pop' when they should be smooth everytime the zoom factor loops. So, having realised i needed to apply an offset to compensate for the zoomed origin of the graph, i now have issues with scrolling through it smoothly. It appears to be non-trivial in calculating the cell distance travelled via a modulus.
So...i feel i'm probably going tackling this issue the wrong way and making it more difficult than expected. So the question should be more, how would you do it..so that ultimately it will support framing of a certain region of data and so on and allow the user to smoothly scrolling around, in and out like the softimage editor etc..
Any ideas/insights would be helpful. thanks
Answer by KB73 · May 15, 2014 at 08:59 PM
Also, there is no 'camera' in the editorwindow so it has to be either manipulation of the GL verts or using Matrix4x4 class and submitting that...both show the same issue. The biggest issue i am having is with the scrolling of the grid. Trying to use something like scrollOffset % cellSize is failing to work when the thing zoomed.....regardless of whether the cellSize is a zoomed or unzoomed value.
All fixed, best info i found was in a book online called Practical Charts and Graphs C# and it pretty much addressed everything i needed.
Can I get an example of ur code? I am trying to do the same thing as a part of a bigger project, but I'm having trouble getting started. Ty
Your answer
Follow this Question
Related Questions
Unsmooth camera on sprite diffuse 0 Answers
How to make a simple "That's all folks!" effect in 2D? 1 Answer
Unity2D Grid disappears when zooming out 0 Answers
Material is destroying sprite`s quality 1 Answer
Android Build has bad quality 0 Answers