I am trying to get the 2D screen position from 3D coordinates, using view3D.project function, but I get a weird Vector3D with only Z set:
view3DInstance.project(Vector3D(-79.481308, 0, -208.73399999999998)
(0, 0, 7579.776523938959)
Is this a bug or a correct result I can’t interpret or don’t understand…?
camera settings are
camera.lens = new PerspectiveLens(10);
camera.lens.far = 10000;
camera.position = new Vector3D(2850, 4200, -5800);
camera.rotationY = - 28.89;
camera.rotationX = 32.8;
What is the width and height of your
0 and 0.
I have tried setting width and height in the constructor of the class that extends View3D (is it correct?), but now it looks like the projection has been applied through a slightly rotated camera (and my camera is rotated )
EDIT: I have moved the lines that set width and height at the end of the constructor and now the projections ar perfect! Do I have to set them after the camera?
Perhaps you could use
view3DInstance.camera.project(Vector3D(-79.481308, 0, -208.73399999999998);
It looks like
view3D.project is similar to doing
view3D.camera.project, except it multiplies it by the width and height of the
View3D instance. If it is zero, then it will zero your