CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.66k stars 3.43k forks source link

Setting HeightReference to None on 3D Models doesn't update the 3D Model position #12080

Open stewienj opened 1 month ago

stewienj commented 1 month ago

What happened?

The height reference on entity models starts out as undefined. With this setting the height is absolute. If you set ground clamping as follows: entity.model.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND; Then as expected the entity will sit on the ground. If you then set the height reference to NONE or undefined, then the entity still retains the CLAMP_TO_GROUND setting until you change another property on the Entity.

I tried this on billboards. Billboards work fine with setting the HeightReference to NONE, indicating this issue might be in just the 3D Model code.

Reproduction steps

  1. Run the sandcastle example below
  2. On the combo box select "Clamp to ground", and note the truck drops to the ground
  3. On the combo box select "No Clamping" and note the truck stays on the ground
  4. If you turn on "Track entity" and repeat steps 2 and 3 above the camera will move, but the 3D model will not move.

Sandcastle example

Example

Environment

Browser: Edge version 126.0.2592.87 CesiumJS Version: 1.119 Operating System: Windows 10 22H2

ggetz commented 1 month ago

Thanks @stewienj, I can also reproduce. I agree that this is isolated to model entities, likely in ModelVisualizer.js.