osgearth icon indicating copy to clipboard operation
osgearth copied to clipboard

Terrain avoidance doesn't work with middle mouse button pressed in earth manipulator

Open keince opened this issue 3 years ago • 5 comments

Playing with the osgearth_manip.exe example, I noticed that enabling terrain avoidance (via ToggleCollisionHandler) doesn't have any effect when using the middle mouse button (hold down and moving the mouse up and down) to move the viewpoint close to the ground.

This can be seen by using the osgearth_manip.exe with an earth file pointing to terrain data:

  1. zooming in to an area where terrain is present
  2. pressing the middle mouse button down while moving the mouse vertical until the viewpoint is under the terrain.

If terrain avoidance is enabled, the camera should clamp to the minimum distance defined and not go through the terrain surface.

keince avatar Sep 07 '21 22:09 keince

I count not repro it your way, but I could repro by positioning the camera above a mountain, and then pitching up so that the camera went down into the ground underneath.

gwaldron avatar Sep 08 '21 12:09 gwaldron

Okay. That is what I was trying to describe. Perhaps a screen capture would be helpful...

I first position my camera as so... CaptureAboveGnd

keince avatar Sep 08 '21 14:09 keince

While holding down the middle mouse button and moving the mouse cursor up on the screen, I get this... CaptureBelowGnd

keince avatar Sep 08 '21 14:09 keince

Toggling the collision using the 'k' key had no effect. I was still able to go under the terrain

At any rate, I'm glad you were able to repro the problem.

keince avatar Sep 08 '21 14:09 keince

I have a fix for this, but it till have to wait until after the 3.3 release (because of breaking APIs).

gwaldron avatar Apr 05 '22 16:04 gwaldron