summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Entity.cpp2
-rw-r--r--src/Entities/Player.cpp11
-rw-r--r--src/Entities/Player.h6
-rw-r--r--src/Entities/ProjectileEntity.cpp3
4 files changed, 20 insertions, 2 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 221cbbea7..8ef45f1a5 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1469,7 +1469,7 @@ void cEntity::SteerVehicle(float a_Forward, float a_Sideways)
Vector3d cEntity::GetLookVector(void) const
{
Matrix4d m;
- m.Init(Vector3f(), 0, m_Rot.x, -m_Rot.y);
+ m.Init(Vector3d(), 0, m_Rot.x, -m_Rot.y);
Vector3d Look = m.Transform(Vector3d(0, 0, 1));
return Look;
}
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;
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index a9735a53c..e86bb48bd 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -371,13 +371,14 @@ void cProjectileEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
SetYawFromSpeed();
SetPitchFromSpeed();
- // DEBUG:
+ /*
LOGD("Projectile %d: pos {%.02f, %.02f, %.02f}, speed {%.02f, %.02f, %.02f}, rot {%.02f, %.02f}",
m_UniqueID,
GetPosX(), GetPosY(), GetPosZ(),
GetSpeedX(), GetSpeedY(), GetSpeedZ(),
GetYaw(), GetPitch()
);
+ */
}