Excelent!

The first solution worked perfect for me, and the second made me
better understand the transform function :)

tnx!

On Aug 24, 10:55 pm, David Lenaerts <[email protected]> wrote:
> There's an easier way if you directly use the camera's transformation
> matrix. The 3rd column of a transformation matrix is always the local Z-axis
> in the transformation's destination space. So the camera's transform object
> has its local z-axis (which is the "forward" vector) in scene coordinates.
> Getting that is pretty straightforward:
>
> var camDirVector : Number3D = new
> Number3D(camera.transform.sxz, camera.transform.syz, camera.transform.szz);
>
> Since your camera isn't (or shouldn't be) scaled, it's also unit-length, so
> a position 100 in front of the cam is simply as follows:
>
> pos.x = cam.x + camDirVector.x*100;
> pos.y = cam.y + camDirVector.y*100;
> pos.z = cam.z + camDirVector.z*100;
>
> Alternatively, you can also do something like this:
>
> pos = new Number3D();
> tgt = new Number3D(0, 0, 100);
> pos.transform(tgt, camera.transform);
>
> This literally means: I want an object 100 in front of the cam, but
> expressed in the camera's parent (ie: scene) coordinates. Both do the same
> thing, but the former method should be a bit faster, if it matters.
>
> Hope that helps!
> David
>
>
>
>
>
> On Tue, Aug 24, 2010 at 5:44 PM, Rich Elmes <[email protected]> wrote:
> > maybe there is something that i didn't find in away3d, but i achieved
> > this with this method :
>
> > create a dummy object (ObjectContainer3D)
> > copy position and rotation values from the camera to the dummy object
> > call moveForward(100) on the dummy object
> > now the dummy object is your point in front of the camera at distance
> > 100 and difference in position between camera & dummy object is a
> > vector of your "looking direction"
>
> > On Aug 24, 9:57 am, Flyon <[email protected]> wrote:
> > > After moving the camera around, I want to calculate the coordinates of
> > > a point right in front of the camera, at say distance 100..
> > > Is there any way to get the vector of my 'looking direction' ?
>
> --
> David Lenaerts
> Flash platform developerhttp://www.derschmale.com

Reply via email to