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

Mouse click to cube coordinates #1213

Open
StephenWitherden opened this issue Apr 28, 2024 · 1 comment
Open

Mouse click to cube coordinates #1213

StephenWitherden opened this issue Apr 28, 2024 · 1 comment
Labels

Comments

@StephenWitherden
Copy link

Hi, there, thank you for this awesome library.

I am working to include a depth map for measurement purposes. Effectively, what I want to implement is your suggestion in #1128 but using a cube map rather than the equirectangular image. I am also aware that getting from mouse coordinates to equirectangular coordinates is trivial as you say in #765.

Should I just go the equirectangular route, or is there a nice neat algorithm I could use to map a mouse click to coordinates on a multidimensional cube map? I am preferring cubes because of performance on large panoramas.

@mpetroff
Copy link
Owner

mpetroff commented May 1, 2024

This Stack Exchange answer describes how to go from latitude / longitude to cube face coordinates (in C#, but it's straightforward to convert to JavaScript):
https://gamedev.stackexchange.com/a/137303

The pitch / yaw returned by mouseEventToCoords is equivalent to latitude / longitude. It might take some trial and error to get the face mapping and coordinate signs correct, but that should get you started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants