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

Add clamping functionality directly in CZML and Entity API #7044

Closed
lilleyse opened this issue Sep 17, 2018 · 8 comments · Fixed by #11604
Closed

Add clamping functionality directly in CZML and Entity API #7044

lilleyse opened this issue Sep 17, 2018 · 8 comments · Fixed by #11604

Comments

@lilleyse
Copy link
Contributor

The Clamp to 3D Tiles demo in #6934 manually clamps the entity's position to a tileset based on a scene.clampToHeight call. It would be convenient to offer this functionality from CZML and the entity API.

@mramato
Copy link
Contributor

mramato commented Sep 17, 2018

I imagine the most straightforward way to do this would be to extend the HeighReference enum to cover 3D Tiles (probably always terrain and 3d tiles at the same time)

@ggetz
Copy link
Contributor

ggetz commented May 26, 2023

Also requested in #11305.

@ryanhlewis
Copy link

Hi from #11305.

I ended up using a Raycast for everything, which looks like:

    // Get position from lat/lon
    const position = Cesium.Cartesian3.fromDegrees(lng, lat, 10000); // Assume initial altitude of 10,000m

    // Cast a ray from position to the center of the Earth
    const ray = new Cesium.Ray(position, Cesium.Cartesian3.negate(Cesium.Cartesian3.fromDegrees(lng, lat), new Cesium.Cartesian3()));
    
    // Intersect the ray with the tileset
    const intersection = viewer.scene.pickFromRay(ray, [tileset]);

However, yes, I would love using a direct implementation, and not a hacky workaround.

@ggetz
Copy link
Contributor

ggetz commented Sep 22, 2023

From Sean in #8606:

I'm a little worried that scene.clampToGround won't scale super well. Terrain keeps triangle data in CPU memory, wonder if we need to do the same for 3D Tiles at some point. And then optimize ray/triangle intersection tests.

@ddomit
Copy link

ddomit commented Mar 12, 2024

Hello! Any news on this implementation? @ggetz

We need to get the altitude of a point from 3dTiles

Thanks!

@ggetz
Copy link
Contributor

ggetz commented Mar 12, 2024

We need to get the altitude of a point from 3dTiles

@ddomit Are you looking to clamp a point to the surface of 3D Tiles, or sample the height directly?

@ddomit
Copy link

ddomit commented Mar 12, 2024

We need to get the altitude of a point from 3dTiles

@ddomit Are you looking to clamp a point to the surface of 3D Tiles, or sample the height directly?

I am looking to do both actually :) @ggetz

@ddomit
Copy link

ddomit commented Apr 16, 2024

We need to get the altitude of a point from 3dTiles

@ddomit Are you looking to clamp a point to the surface of 3D Tiles, or sample the height directly?

Any new features to implement this?

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

Successfully merging a pull request may close this issue.

5 participants