@@ -223,6 +223,12 @@ function ScreenSpaceCameraController(scene) {
223
223
*/
224
224
this . minimumPickingTerrainHeight = 150000.0 ;
225
225
this . _minimumPickingTerrainHeight = this . minimumPickingTerrainHeight ;
226
+ /**
227
+ * The minimum distance the camera must be before testing for collision with terrain when zoom with inertia.
228
+ * @type {number }
229
+ * @default 4000.0
230
+ */
231
+ this . minimumPickingTerrainDistanceWithInertia = 4000.0 ;
226
232
/**
227
233
* The minimum height the camera must be before testing for collision with terrain.
228
234
* @type {number }
@@ -2158,6 +2164,8 @@ function pan3D(controller, startPosition, movement, ellipsoid) {
2158
2164
const zoom3DUnitPosition = new Cartesian3 ( ) ;
2159
2165
const zoom3DCartographic = new Cartographic ( ) ;
2160
2166
2167
+ let preIntersectionDistance = 0 ;
2168
+
2161
2169
function zoom3D ( controller , startPosition , movement ) {
2162
2170
if ( defined ( movement . distance ) ) {
2163
2171
movement = movement . distance ;
@@ -2189,10 +2197,12 @@ function zoom3D(controller, startPosition, movement) {
2189
2197
zoom3DCartographic
2190
2198
) . height ;
2191
2199
2192
- const inertiaMovementApproachingGround = Math . abs ( height ) < 50 ;
2200
+ const approachingCollision =
2201
+ Math . abs ( preIntersectionDistance ) <
2202
+ controller . minimumPickingTerrainDistanceWithInertia ;
2193
2203
2194
2204
const needPickGlobe = inertiaMovement
2195
- ? inertiaMovementApproachingGround
2205
+ ? approachingCollision
2196
2206
: height < controller . _minimumPickingTerrainHeight ;
2197
2207
if ( needPickGlobe ) {
2198
2208
intersection = pickGlobe ( controller , windowPosition , zoomCVIntersection ) ;
@@ -2201,6 +2211,7 @@ function zoom3D(controller, startPosition, movement) {
2201
2211
let distance ;
2202
2212
if ( defined ( intersection ) ) {
2203
2213
distance = Cartesian3 . distance ( ray . origin , intersection ) ;
2214
+ preIntersectionDistance = distance ;
2204
2215
}
2205
2216
2206
2217
if ( cameraUnderground ) {
0 commit comments