17 lines
726 B
Lua
17 lines
726 B
Lua
-- Top-down minimap: a fixed-size, top-right, non-interactive second camera
|
|
-- - proves screen-region targeting isn't limited to one camera. Not wired
|
|
-- into picking (see cursor_to_world_ray's full-window assumption in
|
|
-- hex.c), so it's display-only.
|
|
|
|
local overlay = ui.create_overlay{anchor = ANCHOR_TOP_RIGHT, offset = {-10, 10}, size = {250, 250}}
|
|
|
|
local top_down = camera.create()
|
|
top_down:attach(overlay)
|
|
top_down:set_position(0, 0, 0)
|
|
-- Just shy of straight down (pi/2) - exactly vertical is singular for
|
|
-- glm_lookat against the {0,1,0} up vector (same bound editor.c's own pitch
|
|
-- clamp uses for the main camera).
|
|
top_down:set_rotation(0, math.pi/2 - 0.1)
|
|
top_down:set_distance(30)
|
|
top_down:set_aspect(250, 250)
|