_view.unproject() is broken?

Software: Away3D 4.x

Avatar
SasMaster, Sr. Member
Posted: 17 November 2011 03:12 PM   Total Posts: 127

HI All.Anybody happened to use _view.unproject?

If I put a plane at (0,0,500);

And do :

protected function onMouse3DMove(event:MouseEvent3D):void
  {

  var vec1:Vector3D=_view.unproject(mouseX,mouseY);
 
  trace(vvec1);

  }

The unproject returns 3d coordinates like these:
Vector3D(-1.5011106729507446, 0.2309400886297226, 20.000001907348633)

Anyone has an idea what is going on here?

 Signature 

This looks like a job for superman
http://blog.alladvanced.net

   

John Brookes, Moderator
Posted: 17 November 2011 04:36 PM   Total Posts: 732   [ # 1 ]

Dont’ know if its broken or if its supposed to do this but.

It returns the world position of a click on the near plane (frustum).

   

Avatar
SasMaster, Sr. Member
Posted: 17 November 2011 06:11 PM   Total Posts: 127   [ # 2 ]

That is strange.if I set the plane at zero and move the camera backwards then unprojected z value appears correct.  X and Y look like they come from the near plane. In away 3 it actually worked fine.

 Signature 

This looks like a job for superman
http://blog.alladvanced.net

   

Avatar
Fabrice Closier, Administrator
Posted: 17 November 2011 08:46 PM   Total Posts: 1265   [ # 3 ]

Take a look at Drag3D class where unproject is being used.

   

Avatar
SasMaster, Sr. Member
Posted: 17 November 2011 09:38 PM   Total Posts: 127   [ # 4 ]

Indeed a good idea Fabrice. Btw,when do we see Prefab 2.0? wink

 Signature 

This looks like a job for superman
http://blog.alladvanced.net

   

Avatar
Fabrice Closier, Administrator
Posted: 17 November 2011 10:47 PM   Total Posts: 1265   [ # 5 ]

You are not the only one missing this baby smile Every moment I have goes to it.  It’s simply a lot of work… I do all I can to release a very light version that will allow imports/exports. Which is basically the most wanted feature for away3d 4.0 projects…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X