away3d/away3d-core-fp11

Drag3D / MousePicking bug with Orthographic lens (A3D v4.1.6)

Opened this issue · 2 comments

I’m trying to create a library for doing Isometric games in Away3D (because I like torturing myself apparently).

I’ve drawn a grid of boxes on the X/Z axis and now I’m trying to determine what the position of a user click is in X/Z space assuming the plane is @ 0 Y.

I’m sure there are several ways of doing this, but I decided to try using the Drag3D class as it seemed the simplest.

Everything works just fine using the default “Perspective” lens, but if I simply change the lens to Orthographic the intersect numbers are all over the place.

I applied the fix mentioned in bug #683 and while it made things better, I am still having problems.

Here is an example application you can view online:
http://www.robertshady.com/sites/www.robertshady.com/files/2014-03-30_Drag3D-bug/index.html

NOTE: Notice that at the top of the grid it's approximately X: 980 and Z: 980 and at the BOTTOM of the grid it is ALSO X: 980 and Z:980 (while in Orthographic mode).

And here is the source code to that example:
http://www.robertshady.com/sites/www.robertshady.com/files/2014-03-30_Drag3D-bug/Main.as

Thanks!
-- Rob

Not fully tested with all of the Drag3d options but should work in your Ortho/Perspective example.

https://gist.github.com/JohnBrookes/4898c006c23a6aa71d0b

As before make sure you have also applied the fix for the ortho bug #683

Seems to work, very nice! Thank you so much!