reearth/craco-cesium

Wrong height

badoubadou opened this issue · 1 comments

Hi,
I'm loading an asset from cesium ion.

The issue is it's not showing the proper height. When I look at the asset on the cesium ion page, the height is correct, ie on the ground.
But when I look at it with craco-cesium it float above the ground.
What should I do ?

here is my code :

import React from "react";
import { Viewer, Cesium3DTileset } from "resium";
import { IonResource, Ion  } from "cesium";

function ResiumPlayer(props) {
  Ion.defaultAccessToken = process.env.REACT_APP_ION_TOKEN;
  let viewer; // This will be raw Cesium's Viewer object.
  const AssetId = props.IonAssetId;
  if(!AssetId){
    return false;
  }
  const handleReady = tileset => {
    if (viewer) {
      viewer.zoomTo(tileset);
      viewer.infoBox.frame.sandbox = "allow-same-origin allow-top-navigation allow-pointer-lock allow-popups allow-forms allow-scripts";
    }
  };
  return (
    <Viewer
      full
      ref={e => {
        viewer = e && e.cesiumElement;
      }}>
      <Cesium3DTileset url={IonResource.fromAssetId(AssetId)} onReady={handleReady} />
    </Viewer>
  );
}

export default ResiumPlayer;

Thanks
Best

Found it.
Needed cesium world terrain.

import { Cartesian3, createWorldTerrain } from "cesium";
const terrainProvider = createWorldTerrain();
function App() {
  return (
    <Viewer full terrainProvider={terrainProvider}>