Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera "look at" with adjustable height #12563

Closed
Bulisor opened this issue Feb 9, 2023 · 4 comments
Closed

Camera "look at" with adjustable height #12563

Bulisor opened this issue Feb 9, 2023 · 4 comments

Comments

@Bulisor
Copy link

Bulisor commented Feb 9, 2023

Motivation

Hi,
I am using Mapbox with babylonjs to display 3d buildings on map. It is working very well so far.
I was wondering if there is a way to set the camera "look at" position at a different height, or to change the height of the camera target. Currently, it seems that the camera always looks at the target at 0 height

The ability to set the camera height for the "look at" feature would provide more flexibility and enhance the user experience for all who are using 3d on mapbox.

https://prnt.sc/ql8hlW1CMFAU

Thanks

@stepankuzmin
Copy link
Contributor

Hi @Bulisor,

Thank you for using mapbox-gl-js. You can change the camera altitude with FreeCameraOptions:

const camera = map.getFreeCameraOptions();

const position = [138.72649, 35.33974];
const altitude = 3000;

camera.position = mapboxgl.MercatorCoordinate.fromLngLat(position, altitude);
camera.lookAtPoint([138.73036, 35.36197]);

map.setFreeCameraOptions(camera);

I'll close the issue, but feel free to reopen if you have any questions.

@Bulisor
Copy link
Author

Bulisor commented May 17, 2023

Hi @stepankuzmin , thank you for your response. Unfortunately, this is not what I'm seeking. When using this option, the camera simply zooms out on the target, and I do not desire that. Instead, I would like the same zoom level, but positioned at a specific distance above the ground along the Y-axis. I hope I have explained it more accurately.

@artu-ole
Copy link

Hi there, this looks like a duplicate of #3552 to me?

@stepankuzmin
Copy link
Contributor

Yes, this is a duplicate of #3552.

@stepankuzmin stepankuzmin closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants