From 1cab52f86799b98940da910e84e207b6037a5cd2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 4 Apr 2014 23:06:47 +0200 Subject: Added cPlayer:SendRotation() API function. --- src/Entities/Player.cpp | 11 +++++++++++ src/Entities/Player.h | 6 ++++++ 2 files changed, 17 insertions(+) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 646aad50f..7f2e5b4c2 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1124,6 +1124,17 @@ void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) +void cPlayer::SendRotation(double a_YawDegrees, double a_PitchDegrees) +{ + SetYaw(a_YawDegrees); + SetPitch(a_PitchDegrees); + m_ClientHandle->SendPlayerMoveLook(); +} + + + + + Vector3d cPlayer::GetThrowStartPos(void) const { Vector3d res = GetEyePosition(); diff --git a/src/Entities/Player.h b/src/Entities/Player.h index ea32dbfb9..05377a117 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -129,6 +129,12 @@ public: // tolua_begin + /** Sends the "look" packet to the player, forcing them to set their rotation to the specified values. + a_YawDegrees is clipped to range [-180, +180), + a_PitchDegrees is clipped to range [-180, +180) but the client only uses [-90, +90] + */ + void SendRotation(double a_YawDegrees, double a_PitchDegrees); + /** Returns the position where projectiles thrown by this player should start, player eye position + adjustment */ Vector3d GetThrowStartPos(void) const; -- cgit v1.2.3