How to simulate a MouseEvent3D.MOUSE_DOWN event

Software: Away3D 4.x

beers, Member
Posted: 24 February 2013 05:01 AM   Total Posts: 53

I need to do a mouse-pick *without* clicking a mouse button. I need the MouseEvent3D.MOUSE_DOWN event to fire when i press a key instead (so the picking would occur at the stage.mousex,stage.mousey).

So im thinking there has to be a way to ‘trigger’ a mouse3D mousedown event without actually having to press the mouse button?

The only workaround I can figure is if i have a mouseOver3D event handler but id like to avoid that since i believe its way slower.

If anyone has any ideas I’d be very greatful!

   

parele, Jr. Member
Posted: 12 March 2013 11:55 AM   Total Posts: 43   [ # 1 ]

Set up A mouseMove3d Event and constantly track it position

var myLocalposition:vector3D

MyMesh
.addEventListener(MouseEvent3D.MOUSE_MOVETheTracker;

function 
TheTracker(e:MouseEvent3D):void
{

 myLocalposition
e.localPosition ;// or e.screenX etc..
         
}

//Now just make a keyisdownHandler and reference "myLocalposition".
//that will give you the co-ordinates of what have you on the key press: 

Hope it helps,

   

beers, Member
Posted: 28 April 2013 01:50 AM   Total Posts: 53   [ # 2 ]

Solved my own problem.

The solution is to use a RaycastPicker object. away3d/core/pick/RaycastPicker.as

ie: RaycastPicker.getViewCollision(x, y, view) will return a collision object (if there were any collisions)

Picking objects in the scene require MouseEnabled=true.

beers

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X