felixpalmer / procedural-gl-js

Mobile-first 3D mapping engine with emphasis on user experience

Home Page:https://www.procedural.eu/map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Camera bug

pavelvasev opened this issue · comments

Hi Felix!

First of all, thank you very much for your great project! What about the issue, I tried to fix it by myself with PR in mind, but failed to do that. So I just report it to you.

Describe the bug
If to follow example of call to configureControls presented at
https://github.com/felixpalmer/procedural-gl-js/blob/main/src/export/controls.js#L37
we see option value maxPolarAngle: 0.8 * Math.PI.
That's great idea because it allows us for example to look on mountains from below to top.

However, on more-less flat surfaces the camera easily goes below ground level when this maxPolarAngle value is used.
And then, the view sometimes becomes corrupted, with no way to return above ground level.

To Reproduce
Steps to reproduce the behavior:

  1. Use configureControls function with maxPolarAngle: 0.8 * Math.PI option.
  2. Move camera under ground (below ground level) using rotation.
  3. Pan it a little bit (staying below ground).
  4. See no way back for camera to the above ground level ;-)

Screenshot from 2021-05-11 14-37-44