I’m having problems using MouseEvent3D to pick a humanoid mesh.
When I hover the mouse near the centre of the mesh, the picking works fine, however the picking does not trigger anywhere else on the mesh.
It occurs to me that that the picking could be triggered by the original size of the mesh (it has been scaled x50) and not the full size.
The mesh is held within an objectContainer3D. I have tried scaling the object container, or the mesh itself - and the picking acts the same way.
mesh.mouseEnabled=true;
mesh.addEventListener(MouseEvent3D.MOUSE_OVER, mouseOver, false, 0, true);
mesh.addEventListener(MouseEvent3D.MOUSE_OUT, mouseOut, false, 0, true);
container.addChild(mesh);
container.rotationY = angle;
container.x = x;
container.y = y;
container.z = z;
//mesh.scale(50)
container.scale(50);
scene.addChild(container);
I tried running the program without the scaling and the mesh was tiny. Hovering the mouse over it produced no pickings. It could be that the scaled down mesh and the scaled up mesh have the same relative area of selectable mesh, roughly in the centre or abdomen area, and the smaller mesh was just so tiny I couldn’t find this area with the mouse.
Something seems to have gone wrong with the bounding areas, any ray of light people could shine on this would be appreciated!
Update: I used
mesh.showBounds = true
to highlight the mesh.bounds being used for the picking - and it shows that the original (small) size position and orientation of the mesh is being used for the picking
- how can I get the picking mechanism to use the up to date size and position of the mesh?