useGlobePick
Get the coordinates on the ellipsoid as rays.
Usage
js
// Usually you can use it with `useEventHandler`
const globePick = useGlobePick()
const eventHandler = useEventHandler()
eventHandler(({ position }) => {
const pos = globePick(position)
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
This method will only obtain the coordinates on the ellipsoid + terrain
, and will ignore the tileset and model.
Type Declarations
Details
ts
/**
* Get the coordinates on the ellipsoid as rays
*
* ## example
* ```js
* const globePick = useGlobePick()
*
* const eventHandler = useEventHandler()
* eventHandler(({ position }) => {
* const pos = globePick(position)
* }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
* ```
*/
export declare function useGlobePick(
viewer?: Viewer,
): (position: Cartesian2) => Cartesian3 | undefined