Skip to content

viewer.flyTo frames a small ground-clamped polygon using an unexpectedly large bounding sphere #13715

Description

@PFOXP2

What happened?

CesiumJS version: 1.144.0

When calling viewer.flyTo(entity) for a small ground-clamped entity that contains both PolygonGraphics and PolylineGraphics, the camera flies much farther away than expected. At an oblique pitch, the visible polygon can also appear offset from the intended target.

The source-coordinate bounding sphere for this polygon has a radius of approximately 74 m. After the ground primitive is ready, the rendered entity bounding sphere has a radius of approximately 4.5 km in this reproduction. viewer.flyTo(entity) appears to use the rendered bounding sphere, so range: 0 produces a very distant automatic camera range.

I expected viewer.flyTo(entity) to frame the visible polygon at a practical scale and center it consistently at an oblique pitch. If the conservative rendered bounds are intentional for ground primitives, is there a supported public API for waiting until an entity is renderable and then flying to source-geometry bounds?

Reproduction steps

  1. Open the Sandcastle reproduction: .
  2. Open the browser developer console.
  3. Click Log bounding spheres.
  4. Observe that the raw geometry bounding sphere is much smaller than the rendered entity bounding sphere.
  5. Click Fly with viewer.flyTo.
  6. Observe the distant camera view.
  7. Click Fly with raw geometry.
  8. Compare the result. This uses camera.flyToBoundingSphere with a bounding sphere calculated from the source polygon coordinates.

The reproduction uses:

  • polyline.clampToGround = true
  • classificationType = Cesium.ClassificationType.BOTH

Sandcastle example

https://sandcastle.cesium.com/#c=rVh7b9s4Ev8qA+39Ie85tJ3YberEwbaJ2wbINkHi22JRFbu0NLJ5pUgfScXxFv7uB0rUM3K3e7cBjFijef44L5olG6kM/AhUwyVqliYQK5lA4IXZU+CdBSoQLGd7oCIKqTYcC66K4jjtJ5RCG3hkuEUFMxC4dbrJLxnNL7RfSmEoE6gCrw9frSiAQaUoE9NCZJE/E2vwo1Q8cgS/188FqGAJNUyKKcSUa3RkwxLkTGCTuqQab+gO1R0Lv6Cqv9z3ygBy14kOUSBZcblEEuHGrBeozesVZUIb5wXMwKgUW6FvpGbWIw2zIoxLqgxqRsVJFskVrhSifq0U3fmfct9GowkZTSajVy9ejV9Oxn04GZMXL4bjk+Pxq/Hk+GTUL1hejl+O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I4lGIFMDWwpMxY065n5BpwWx46sPAhpDdBGnSr8T4pFqdZ6yr6Z5d8hs2+1aKp3IoSyUXO5aiaq9luzsgj12T5GLSiHO/3Z88EXePd0Cys33NrY2f382fA5oKaA3212XZo63S7U5ctBAePv1q18yk3hH18PTUBi5Fv2hJF/3NtDclYlQU2002qnPIEHxCyZXGxZci2lWbsoNPm9e8pW9yHbxBdS8iVVb1JjpPAD7y3fgd0ei+SI+W4hLSL5yTe6fH6EXTnQxMm7pJxbfOs6/Rz8Xm5N2eXD9lJS7Uwd3P2qNKNUuSvViEzKopHZyjP99o5jd5tvLTVQW1GKAqgq5zvxU7Vc/bvwC2mCiuaItAoqs5n1lnqNVG2lielhRc8XuO/GvGPz/B9BvJGrdlFqi2EDvS7cSDZVfL9j1SpaQPaqvTzlQGdE0tivu3z/fzCsEKwW7D/Dz5muN53A+5fOq9/k0MEyw06DkRDKZGPXk3r9NPLjqMyPrVRfaHajIu6Omtvy+t65NjuOF9baT+63lVRxn5CBwWTDqUE9WKbhFzQk1PbOLCzrD+5u9DXH1Q7ulbuxqdWS+uPjPhSfITmdWLn8dLhUU9iumUFHiqUwRzFNGN9NQVOhjzQqFtffavYHTmF0snk6K66ST0fufjkeD0vyhkb2LKZw6kj7QJwPigDPI/YILJp1/OST3yxngRennD+wPzDwLs4HEXtsiHGZdZjbR1Sc7izLenRxkxMJIeeD9ahDyp1c4GUYV/Ti6liJuP//BQ

Environment

Browser: Google Chrome 151.0.7922.138 (64 bit) / Firefox 147.0.2 (64 bit)
CesiumJS Version: CesiumJS 1.144.0
Operating System: Microsoft Windows 11 Professional 25H2 26200.9168

AI acknowledgment

  • I used AI to generate this issue report.
  • (If the above is checked) I have reviewed the AI-generated content before submitting.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions