Closed lilleyse closed 7 months ago
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)
Also requested in https://github.com/CesiumGS/cesium/issues/11305.
Hi from https://github.com/CesiumGS/cesium/issues/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.
From Sean in https://github.com/CesiumGS/cesium/issues/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.
Hello! Any news on this implementation? @ggetz
We need to get the altitude of a point from 3dTiles
Thanks!
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?
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
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?
The Clamp to 3D Tiles demo in https://github.com/AnalyticalGraphicsInc/cesium/pull/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.