use ScreenVertex coordinates by accessing camera.screen() method . :) On Tue, Jun 15, 2010 at 4:34 PM, JeffH <[email protected]> wrote:
> Hi all. I wanted to get the experts' opinions on the best way to > accomplish what I need to do. I have a 3D object (a boat) that is in a > view with the camera set to a position and roll (45) to try and > achieve a "simcity" look. The settings are like this: > > view.camera.x = 675; view.camera.y = -675; view.camera.z = -1300; > view.camera.roll(45); view.camera.lookAt(new Number3D(0, 0, 0)); > > What I want to do is to move this object based on 2D points located on > the stage (for example, a path along a river). What is the best way to > do this? I did try converting 2D points to 3D by trying to get the > intersect of a ray off a plane but it doesn't seem to work. Not sure > if it is because I have a camera roll... I tried this based on some > other posts (where my 2D point is the var pt): > > var plane:Plane3D = new Plane3D(); > plane.fromNormalAndPoint(new Number3D(0, 1, 0), new Number3D(0, 0, > 0)); > var cameraPosition:Number3D = new Number3D(view.camera.x, > view.camera.y, view.camera.z); > var ray:Number3D = view.camera.unproject(pt.x, pt.y); > ray.add(ray, cameraPosition); > var intersect:Number3D = > plane.getIntersectionLineNumbers(cameraPosition, ray); > > But, intersect.x does not seem to align with pt.x on the screen. > Perhaps I am misinterpreting how this should work? Should I try to > orient the stage (Flash CS4) the same way or can I leave that "flat" > and translate 2D coordinates to the 3D space? > > Anyway, thanks for any guidance! -- Michael Ivanov ,Programmer Neurotech Solutions Ltd. Flex|Air |3D|Unity| www.neurotechresearch.com http://blog.alladvanced.net http://www.meetup.com/GO3D-Games-Opensource-3D/ Tel:054-4962254 [email protected] [email protected]
