Loading...
Loading...
Compare original and translation side by side
flowchart TB
A[Gather stop list] --> B[Resolve coordinates]
B -->|geolocation_search if needed| C[For each stop]
C --> D[Add label at marker position<br/>entity_add_label]
D --> E[Calculate viewpoint<br/>offset from marker]
E --> F[Fly to VIEWPOINT<br/>camera_fly_to]
F --> G[Orbit?<br/>camera_start_orbit]
G --> H[Wait/delay]
H --> I{More stops?}
I -->|yes| C
I -->|no| J[End tour]flowchart TB
A[Gather stop list] --> B[Resolve coordinates]
B -->|geolocation_search if needed| C[For each stop]
C --> D[Add label at marker position<br/>entity_add_label]
D --> E[Calculate viewpoint<br/>offset from marker]
E --> F[Fly to VIEWPOINT<br/>camera_fly_to]
F --> G[Orbit?<br/>camera_start_orbit]
G --> H[Wait/delay]
H --> I{More stops?}
I -->|yes| C
I -->|no| J[End tour]| Marker Type | Camera Offset Strategy |
|---|---|
| City/landmark | Place camera 0.01–0.05° away in lat/lon, 500–2000m altitude, pitch down 20–40° toward marker |
| Region/area | Place camera 0.1–0.5° away, 5000–20000m altitude, pitch down 30–50° |
| Building/POI | Place camera 0.005–0.01° away, 200–800m altitude, pitch down 25–45° |
| 标记点类型 | 相机偏移策略 |
|---|---|
| 城市/地标 | 将相机放置在经纬度偏移0.01–0.05°处,高度500–2000米,向下倾斜20–40°朝向标记点 |
| 区域/地区 | 将相机放置在经纬度偏移0.1–0.5°处,高度5000–20000米,向下倾斜30–50° |
| 建筑/兴趣点(POI) | 将相机放置在经纬度偏移0.005–0.01°处,高度200–800米,向下倾斜25–45° |
Marker position: { longitude: 2.2945, latitude: 48.8584, height: 350 }
Camera viewpoint: { longitude: 2.2945, latitude: 48.845, height: 1200 }
^^^^^^ offset south
Camera orientation: { heading: 0, pitch: -35, roll: 0 }
^^^^^^^^^^ looking down toward marker标记点位置: { longitude: 2.2945, latitude: 48.8584, height: 350 }
相机视点: { longitude: 2.2945, latitude: 48.845, height: 1200 }
^^^^^^ 向南偏移
相机朝向: { heading: 0, pitch: -35, roll: 0 }
^^^^^^^^^^ 向下朝向标记点{
"longitude": -74.0060,
"latitude": 40.7128,
"height": 1000
}{
"longitude": -74.0060,
"latitude": 40.7128,
"height": 1000
}{
"red": 1.0,
"green": 0.0,
"blue": 0.0,
"alpha": 1.0
}{
"red": 1.0,
"green": 0.0,
"blue": 0.0,
"alpha": 1.0
}| Effect | Easing | Use For |
|---|---|---|
| Smooth professional | QUADRATIC_IN_OUT | Most tours |
| Dramatic arrival | CUBIC_IN | Hero locations |
| Gentle float | SINUSOIDAL_OUT | Scenic views |
| Quick snap | LINEAR_NONE | Fast transitions |
| 效果 | 缓动方式 | 适用场景 |
|---|---|---|
| 流畅专业 | QUADRATIC_IN_OUT | 大多数游览 |
| 戏剧性到达 | CUBIC_IN | 核心地标 |
| 平缓浮动 | SINUSOIDAL_OUT | 风景视图 |
| 快速切换 | LINEAR_NONE | 快速过渡 |
| Distance | Duration |
|---|---|
| Same city | 2-3 seconds |
| Regional (100km) | 4-5 seconds |
| Continental | 6-8 seconds |
| Global | 10+ seconds |
| 距离 | 时长 |
|---|---|
| 同城 | 2-3秒 |
| 区域级(100公里) | 4-5秒 |
| 洲际 | 6-8秒 |
| 全球 | 10+秒 |
| Effect | Speed (rad/s) | Direction |
|---|---|---|
| Slow dramatic | 0.002 | counterclockwise |
| Standard showcase | 0.005 | counterclockwise |
| Quick spin | 0.01 | clockwise |
camera_start_orbitcamera_look_at_transformcamera_start_orbitcamera_look_at_transformcamera_start_orbit| 效果 | 速度(弧度/秒) | 方向 |
|---|---|---|
| 缓慢戏剧性 | 0.002 | 逆时针 |
| 标准展示 | 0.005 | 逆时针 |
| 快速旋转 | 0.01 | 顺时针 |
camera_start_orbitcamera_start_orbitcamera_look_at_transformcamera_look_at_transformcamera_start_orbit// 1. Search for location (returns coordinates)
geolocation_search({ query: "Eiffel Tower, Paris" })
// Returns: { longitude: 2.2945, latitude: 48.8584, ... }
// 2. Add label at the ACTUAL location
entity_add_label({
position: { longitude: 2.2945, latitude: 48.8584, height: 350 },
label: {
text: "Eiffel Tower",
font: "24pt sans-serif",
fillColor: { red: 1, green: 1, blue: 1, alpha: 1 },
outlineColor: { red: 0, green: 0, blue: 0, alpha: 1 },
outlineWidth: 2,
style: "FILL_AND_OUTLINE"
},
id: "tour-label-paris"
})
// 3. Fly camera to a VIEWPOINT — NOT to the marker itself!
// Camera is offset south of the marker and elevated, looking
// north and downward so the Eiffel Tower label is clearly visible.
camera_fly_to({
destination: { longitude: 2.2945, latitude: 48.845, height: 1200 },
orientation: { heading: 0, pitch: -35, roll: 0 },
duration: 5,
easingFunction: "QUADRATIC_IN_OUT"
})
// 4. Start orbit (after fly_to completes)
camera_start_orbit({
speed: 0.005,
direction: "counterclockwise"
})
// 5. Wait, then stop orbit
camera_stop_orbit()
// 6. Continue to next stop...
// 7. Cleanup when done
entity_remove({ entityId: "tour-label-paris" })// 1. 搜索地点(返回坐标)
geolocation_search({ query: "Eiffel Tower, Paris" })
// 返回: { longitude: 2.2945, latitude: 48.8584, ... }
// 2. 在实际位置添加标签
entity_add_label({
position: { longitude: 2.2945, latitude: 48.8584, height: 350 },
label: {
text: "Eiffel Tower",
font: "24pt sans-serif",
fillColor: { red: 1, green: 1, blue: 1, alpha: 1 },
outlineColor: { red: 0, green: 0, blue: 0, alpha: 1 },
outlineWidth: 2,
style: "FILL_AND_OUTLINE"
},
id: "tour-label-paris"
})
// 3. 飞往视点——不要直接飞往标记点!
// 相机位于标记点南侧并升高,朝北向下看,以便清晰看到埃菲尔铁塔标签。
camera_fly_to({
destination: { longitude: 2.2945, latitude: 48.845, height: 1200 },
orientation: { heading: 0, pitch: -35, roll: 0 },
duration: 5,
easingFunction: "QUADRATIC_IN_OUT"
})
// 4. 开始环绕(在fly_to完成后)
camera_start_orbit({
speed: 0.005,
direction: "counterclockwise"
})
// 5. 等待后停止环绕
camera_stop_orbit()
// 6. 继续下一个站点...
// 7. 完成后清理
entity_remove({ entityId: "tour-label-paris" })| Mistake | Fix |
|---|---|
| Camera flies to marker coords | Offset the camera so the marker is IN VIEW, not under the camera. See Viewpoint Positioning above. |
Using | Just call |
| Coordinates reversed | Use longitude first: |
| Colors as hex strings | Use object: |
| Flying too fast | Increase duration for long distances |
| Orbit won't stop | Call camera_stop_orbit() explicitly |
| Labels not visible | Check height is above terrain, increase font size |
| Forgetting cleanup | Track entity IDs and call entity_remove |
| 错误 | 修复方案 |
|---|---|
| 相机飞往标记点坐标 | 偏移相机位置,使标记点在视野内,而非相机正下方。请参阅上方的视点定位部分。 |
在环绕前调用 | 直接调用 |
| 坐标顺序颠倒 | 先写经度: |
| 使用十六进制字符串表示颜色 | 使用对象格式: |
| 飞行速度过快 | 长距离飞行时增加时长 |
| 环绕无法停止 | 显式调用camera_stop_orbit() |
| 标签不可见 | 检查高度是否高于地形,增大字体大小 |
| 忘记清理 | 跟踪实体ID并调用entity_remove |
| Server | Role in Tours |
|---|---|
| Camera | fly_to, start_orbit, stop_orbit, set_view |
| Entity | add_label, add_billboard, add_point, remove |
| Clock | Set time-of-day for lighting effects |
| Geolocation | search to resolve place names |
| 服务器 | 在游览中的作用 |
|---|---|
| Camera | fly_to、start_orbit、stop_orbit、set_view |
| Entity | add_label、add_billboard、add_point、remove |
| Clock | 设置时间段以实现光照效果 |
| Geolocation | 搜索解析地点名称 |
camera_look_at_transformcamera_start_orbitcamera_start_orbitcamera_look_at_transform