title: AS3: Local 2D to Global 3D?
body: <p>So, since 3D layers got introduced, AS3 supports the following functions:</p>
  
  <p><code>local3DtoGlobal(point3D:Vector3D):Point</code></p>
  
  <p>and</p>
  
  <p><code>globalToLocal3D(point:Point):Vector3D</code></p>
  
  <p>the first one transforming the point inside of a 3D transformed layer to global 2D stage coordinates and the second one returning the local coordinates of a 2D stage location projected onto a 3D plane (the z coordinate of the Vector3D will be 0).</p>
  
  <p>What i need however is something like</p>
  
  <p><code>local2DToGlobal3D(point:Point):Vector3D</code></p>
  
  <p>that takes 2D local coordinates (within the 3D transformed layer) and returns a Vector3D that represents the position in global 3D space.</p>
  
  <p>example:</p>
  
  <pre><code>//_foo3D:MovieClip is a MovieClip with a 3D rotation applied to it, child of the stage
  //_bar:MovieClip is some test MovieClip, child of the stage
  function asdf(){
      var p:Point = new Point(50,50);
      _foo3D.graphics.beginFill(0,1);
      _foo3D.graphics.drawCircle(p.x, p.y, 50);
      _foo3D.graphics.endFill();
  
      var p3D:Vector3D = _foo3D.FUNCTIONINEED(p);
      _bar.x = p3D.x;
      _bar.y = p3D.y;
      _bar.z = p3D.z;
  
  //the movieClip _bar should now optically lie over the circle drawn within _foo3D
  }
  </code></pre>
  
  <p>how to do this? hope the problem is clear. thanks!</p>