-
- upLeft.rotate(camCenter, -viewAngle, -viewAngle);
- upRight.rotate(camCenter, viewAngle, -viewAngle);
- downLeft.rotate(camCenter, -viewAngle, viewAngle);
- downRight.rotate(camCenter, viewAngle, viewAngle);
-
- upLeft.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
- upRight.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
- downLeft.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
- downRight.rotate(camCenter, -avatar.getAngleXZ(), -avatar.getAngleYZ());
+ cameraCenter = new Point3D();
+ topLeft = new Point3D(0,0, SIZE).rotate(-viewAngle, -viewAngle);
+ topRight = new Point3D(0,0, SIZE).rotate(viewAngle, -viewAngle);
+ bottomLeft = new Point3D(0,0,SIZE).rotate(-viewAngle, viewAngle);
+ bottomRight = new Point3D(0,0,SIZE).rotate(viewAngle, viewAngle);
+
+ topLeft.rotate(-avatar.getAngleXZ(), -avatar.getAngleYZ());
+ topRight.rotate(-avatar.getAngleXZ(), -avatar.getAngleYZ());
+ bottomLeft.rotate(-avatar.getAngleXZ(), -avatar.getAngleYZ());
+ bottomRight.rotate(-avatar.getAngleXZ(), -avatar.getAngleYZ());
+
+ // place camera view at avatar location
+ avatar.getLocation().clone().scaleDown(zoom).addTo(cameraCenter, topLeft, topRight, bottomLeft, bottomRight);