1

Hi i am trying to simply drag an away3d mesh with the mouse but with no luck. as i see it i need to convert the mouseX and MouseY to the 3d world coordinates however, this is what i tried and it doesnt work. also i need it to be draged in enter frame or TIMER. HELP PLEASE :)

PlayerHandle = new Mesh(new CubeGeometry(200, 100, 5));
_view.scene.addChild(PlayerHandle);
PlayerHandle.mouseEnabled = true;
PlayerHandle.addEventListener(MouseEvent3D.MOUSE_MOVE, HandlePlayerHandler);

public function HandlePlayerHandler(me3d:MouseEvent3D):void
{
    PlayerHandle.x = me3d.scenePosition.x;  
}

public function UpdateScene(e:Event):void
{
   _view.render();
}
tomergott
  • 74
  • 11

1 Answers1

1

Away3D has built in class,

import away3d.tools.utils.Drag3D;

e.g.

private var _drag3D:Drag3D;
private var _sphere : Sphere;

//create sphere geometry here in a function
.
.
.
_drag3D = new Drag3D(_view, ObjectContainer3D(_sphere));

private function handleEnterFrame(e:Event) : void
{
  _drag3D.updateDrag();
   _view.render();
}

See this, Drag3DTest Class.

Rajneesh Gaikwad
  • 1,193
  • 2
  • 14
  • 30