I’m having some issues getting mouse clicks, or any mouse events interacting with away3d scenes when using Orthographic lens, OrthographicOffCenterLens in this case, but the same issues apply to a standard OrthographicLens.
// Replace the following
//if (v == null) v = new Vector3D();
//v.x = nX;
//v.y = -nY;
//v.z = sZ;
//v.w = 1;
// With the following
if (v == null) v = new Vector3D();
var translation:Vector3D = Matrix3DUtils.CALCULATION_VECTOR3D;
matrix.copyColumnTo(3, translation);
v.x = nX + translation.x;
v.y = -nY + translation.y;
v.z = sZ;
v.w = 1;
The mouse events do fire, but not correctly, the translation from the stage mouse position to 3D mesh positions seems way off, so rollover or click events etc. don’t fire over the mesh, but from an arbitrary position on screen.
I have tried both Ortho lens options and both exhibit the same behavior, to the extent that makes me question if anybody has them working.
Do you have a way of testing a basic test like this with the AS3 version of Away3D? It would be really interesting to know if this is a bug caused by the Haxe port.
There is a hit testing algorithm that we don’t have in our version, which used PixelBender in the AS3 version, but I think that was for speed only, so I don’t think it would affect this
Yes it is significantly improved, although still offset in the x which may be related to using a OrthographicOffCenterLens, but the rollover and click are working, albeit by clicking to the right of the mesh by a consistent amount.
It does suggest the hit test algorithm is the culprit.
When the project starts, it is orthographic. Mouse interaction occurs for each object.
Clicking the perspective button changes to a perspective view. Mouse interaction continues for each object.
Neko
When the project starts, it is orthographic. Mouse interaction rotates the view… it does not interact with the objects, except when the view is rotated 180 degrees, when interaction does start to occur with objects, though clicking empty areas still rotates the view.
When changing to perspective view, interaction appears to work the same as the Flash target.
I have not tested HTML5, yet. Also, are you running on a retina-style display? What is your primary test target for this project?
The behavior described for Orthographic lens on HTML5 is as described for Neko, mouse movement works to rotate the view, but hit interaction with meshes isn’t correct.
It seems the translation from mouse screen position to 3D space is off, which is particularly problematic when the camera is top down.