cesium中的四种拾取pick
cesium中有好多种物体拾取,在这⾥记录⼀下,⽅便查阅。
1、viewer.scene.pick(windowPosition);
  官⽹介绍:
Returns an object with a `primitive` property that contains the first (top) primitive in the scene at a particular window coordinate or undefined if nothing is at the location. Other properties may potentially be set depending on the type of primitive and may be used to further identify the picked object.
When a feature of a 3D Tiles tileset is picked, pick returns a Cesium3DTileFeature object
  返回scene中指定位置的顶端的primitive属性的的⼀个对象。
  适⽤于选取3D tiles,改变3Dtiles的属性,⽐如颜⾊等。
2、 viewer.scene.globe.pick(ray, viewer.scene);
  其中 var ray = PickRay(movement.position);
  官⽹介绍:
Find an intersection between a ray and the globe surface that was rendered. The ray must be given in world coordinates.
  返回y⼀个ray和地球表⾯的⼀个交点的Cartesian3坐标。
  适⽤于拾取有地形⾼程的点,但不包括模型、倾斜摄影等表⾯⾼度。需要开启深度测试 depthTestAgainstTerrain = true。
3tiles
3、viewer.scene.camera.pickEllipsoid(movement.position, ellipsoid);
  官⽹介绍:
Pick an ellipsoid or map.
Returns:
If the ellipsoid or map was picked, returns the point on the surface of the ellipsoid or map in world coordinates. If the ellipsoid or map was not picked, returns undefined.  返回的是椭圆球体表⾯的⼀个Cartesian3坐标。
  适⽤于裸球表⾯的选取,是基于数学模型的椭圆球体。
4、viewer.scene.pickPosition(movement.position);
  官⽹介绍:
Returns the cartesian position reconstructed from the depth buffer and window position.
  返回⼀个被屏幕坐标和深度缓存指定的点。
  适⽤于模型表⾯位置的选取,通俗的说就是camera看过去第⼀个被挡住的模型(如entity)上的坐标,通常结合其他的选取⽅式⼀块⽤于选取模型和球上的点。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。