Skip to content

第一人称漫游

框架支持自定义路径,实现第一人称漫游效果

注意

INFO

自定义路径时,采集的路径点并不是鼠标点击的位置点,而是当前视角下的相机位置点,位置点为经纬度格式(x,y,z)

TIP

推荐:可以与相机位置获取方法一起使用,快捷创建漫游过程点

代码实例

ts
let map: any
LarkExplorer.ready({
    baseUrl: './dist/resources/',
  }).then(()=>{
    map = new LarkExplorer.Map('map')
  })

//自定义漫游路径,相机位置点
const points = [
  [120.0367987055442, 35.87086209988223, 967.6219017737544],
  [120.05206808078792, 35.87990189002073, 970.8177040305604],
  [120.07462892319644, 35.88960224615288, 974.2474122346641],
  [120.094553615428, 35.90114460088472, 978.3288971451765],
  [120.10444959891637, 35.90958870400347, 981.3151619898712],
  [120.11495354414902, 35.91620420562088, 970.6299632633708],
  [120.13052409756521, 35.922300642288185, 972.7863251493019],
  [120.14457483945817, 35.92654291028137, 974.2869426461612],
]

// 开始漫游
const start = () => {
  map.Navigation.Roaming.play(points, undefined, false)
}
// 暂停
const pause = () => {
  map.Navigation.Roaming.pause()
}
// 继续
const play = () => {
  map.Navigation.Roaming.continue()
}
// 移除漫游对象
const remove = () => {
  map.Navigation.Roaming.removeAll()
}

运行效果 更多示例