rect.contains(mousePosition) can help me identify if my mouse cursor is on that rectangle. However I don’t think I can be able to identify if my mouse is on a skewed+persp. transform applied rectangle given that these two operations are probably performed by the drawer and not by rect.
Things I tried:
I couldn’t find ‘skew’ here or when searching in GitHub repo
I felt drawer.perspective() is only for 3D (I read this). I tried drawer.perspective(90.0, width*1.0 / height, 0.1, 100.0) which I thought is the default and won’t affect what I’m seeing but it did affected my 2D drawing.
Hi! It would help me suggest something if I knew what you are trying to build.
As far as I can see, your example image above is in 3D (perspective): parts which are farther away look smaller. BTW one can do 3D in perspective, but also in isometric (where distance does not affect size).
One way to detect what object is under the mouse is to render everything twice: once for the user, and another time to detect identify which object is under the mouse. In this second rendering pass, you render (but do not show to the user) objects with unique flat colors using a renderTarget. This renderTarget has an associated colorBuffer. After rendering you download the colorBuffer from the GPU to the CPU using its shadow. Then you can query what color is at the mouse position, which tells you which object is there.
If there is no skew transformation, could you draw a quad contour from 4 points?
re: If there is no skew transformation, could you draw a quad contour from 4 points?
While I might be able to do that for a rectangle, could you provide a pointer on how I would tilt an image?