271
Support / Re: Draw line
« on: February 05, 2013, 03:17:26 pm »
Sorry, my bad... I was using the old library in my another pc... Din't notice there was an update. Thanks.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50f);
cam.lookAt(new SimpleVector(0, 0, 0));
SimpleVector v3 = Interact2D.reproject2D3DWS(world.getCamera(), frame, 200, 650, 50f);
object.translate(v3.x, v3.y, 0);
SimpleVector tempVec = Interact2D.reproject2D3DWS(camera, buffer, x, y).normalize();
float ratio = tempVec.z / 50f;
float vx = tempVec.x / ratio;
float vy = tempVec.y / ratio;
float vz = tempVec.z / ratio;
SimpleVector v3 = new SimpleVector(vx, vy, vz);
object.translate(v3.x, v3.y, 0);
The reason I divide the 50f is that I set the camera move out for 50f from origin. I use the normalized vector to find coordinates at the origin along the vector from the camera. In S2, the object is properly aligned at the bottom of the screen, but when I put it in S3 which has bigger screen, the object hanged in the middle and does not align to the bottom.