Example:
public class AwayUnprojectTest extends Sprite
{
private var _view:View3D;
private var _camera:Camera3D;
private var _trident:Trident;
public function AwayUnprojectTest()
{
init();
}
private function init():void
{
_view = new View3D();
addChild(_view);
_camera = new Camera3D(new OrthographicLens(800));
// _camera = new Camera3D(new PerspectiveLens()); // PerspectiveLens works well
_camera.position = new Vector3D(-500,1000,-1000);
_camera.lookAt(new Vector3D());
_view.camera = _camera;
_trident = new Trident();
_view.scene.addChild(_trident);
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
protected function onEnterFrameHandler(event:Event):void
{
_trident.position = _view.unproject(mouseX, mouseY, 500);
_view.render();
}
}