Open DimitrisMarm opened 9 years ago
Hi @DimitrisMarm
I'm quiet sure this method (point2Pixel) works well as it's being used in several places. Can you include here the code that's not working for you?
Hi @DiegoGomezDeck
Well i use it first in ICameraConstrainer myCameraConstrainer = new ICameraConstrainer() { ...... public boolean onCameraChange(Planet planet, final Camera previousCamera, final Camera nextCamera) {
Vector2F dim = nextCamera.point2Pixel(new Vector3D(users.get(0)
.getUserPosition()._latitude._degrees, users.get(0)
.getUserPosition()._longitude._degrees, users.get(0)
.getUserPosition()._height));
......
}
and then in builder.getPlanetRendererBuilder().addVisibleSectorListener( new VisibleSectorListener() {
@Override
public void onVisibleSectorChange(
final Sector visibleSector,
Geodetic3D cameraPosition) {
.............
Vector2F dim = _g3mWidget.getNextCamera().point2Pixel(new Vector3D(users.get(0).getUserPosition()._latitude._degrees, users.get(0) .getUserPosition()._longitude._degrees, users.get(0) .getUserPosition()._height)) ;
...................
}
}
is something wrong in my code or the method doesn't work in this way?
Hi @DimitrisMarm
The VisibleSectorListener mechanism produces just an approximation of the visible Sector (merging all the sectors of the visible tiles). As a consequence of it, the "changed' event is not fired for small camera movements.
I suggest you to try updating the position in each camera frame (you can do it just in the CameraConstraint method).
BTW, we're just coding now a new mechanism to detect if the camera was changed between the previous and the current frame... when we merge this new stuff, you can avoid updating the position in every frame and just do it only when the camera position changes. Please keep tuned to "purgatory" changes, I guess sometime in the next week we'll able to merge it.
Hi @DimitrisMarm
Did it help? Can I close this issue?
Hi @DiegoGomezDeck
sorry for the delayed response but i was away for a while.
It help me a lot.
yes you can close the issue.
thanks a lot, Jim
Hey all,
Thanks a lot, Jim