unigine EllipsoidPtr get center 獲取粗略球心座標 獲取當前位置粗略重力方向

   
GeodeticPivotPtr pivot = GeodeticPivot::cast(Editor::get()->getNodeByName("GeodeticPivot"));
    pivot->setOrigin(Vec3(0, 90, 0));
    EllipsoidPtr e = pivot->getEllipsoid();
    Mat4 mat = e->getENUWorldTransform(pivot->getOrigin());
    Vec3 pp = mat.getTranslate();
    mat = e->getNEDWorldTransform(pivot->getOrigin()); 
    Vec3  pp1 = mat.getTranslate();  //pp1 == pp
    Vec3 v = e->toGeodetic(pp1,1); //if origin ==Vec3(0, 0, 0)  pp1 = Vec3(6378137,0,0)   if  origin ==Vec3(0, 90, 0) pp1 = pp1 =(-0.27879723389230870,6378136.9999999935,0)  so get the earth center

double l0 = e->getSemimajorAxis();//l0 = 6378137.0000000000 長軸
  double l1 = e->getSemiminorAxis(); //l1 = 6356752.3142451793 短軸

將當前位置減去球心座標可以作爲當前的重力方向。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章