Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed Dec 16, 2024
1 parent 08fd9d4 commit 2c13449
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions builtin/game/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ function haha()
p:set_look_horizontal(math.random() * math.pi * 4)
p:set_look_vertical(math.random() * math.pi - math.pi/2)

-- Basically the usefulness of storing the point dir relative to the
-- look dir is this:
-- > When the server sets the look dir, the server knows the correct new point dir,
-- > even before the network round-trip to the client
-- or
-- > The two values printed below are equal
-- > (assuming no look dir / point dir changes happen on the client in the meantime)

-- This works both on desktop (or with touch_use_crosshair = true) and with
-- touch_use_crosshair = false.
-- To use this test code with touch_use_crosshair = false, just put your
-- finger anywhere on the screen.

core.log("error", "server-side point dir = " .. clean_vec_print(p:get_point_dir()) .. " (before round-trip)")
core.after(0.5, function()
core.log("error", "server-side point dir = " .. clean_vec_print(p:get_point_dir()) .. " (after round-trip)")
Expand Down

0 comments on commit 2c13449

Please sign in to comment.