Skip to content

Getting Camera Viewing Angle

secondplanet edited this page Dec 10, 2011 · 3 revisions

For some plugins the avid developer may want to get the player's camera angle for various reasons. To do this, follow these simple steps.


1. Create a basic player Movement Event

event(:player_move) do |e|
  player = e.player
end

2. Add a variable which gets the viewing angle, and display it to the player

event(:player_move) do |e|
  player = e.player
  loc = player.eye_location
  player.msg("Pitch: #{loc.pitch}")
  player.msg("Yaw: #{loc.yaw}")
end

3. ???

4. PROFIT!!!


But seriously now, it's that simple and the possibilities are endless.

And remember: If it isn't annoying, you're doing it wrong.