From 93cb674bd24817fb7c051042987db594b0b3eec3 Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 27 Sep 2020 16:32:06 -0700 Subject: [PATCH] Use more realistic yaw/pitch speeds --- bot/phy/phy.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot/phy/phy.go b/bot/phy/phy.go index d1171ff..5492e58 100644 --- a/bot/phy/phy.go +++ b/bot/phy/phy.go @@ -17,8 +17,8 @@ const ( playerHeight = 1.8 resetVel = 0.003 - maxYawChange = 18 - maxPitchChange = 11 + maxYawChange = 7 + maxPitchChange = 5 stepHeight = 0.6 minJumpTicks = 14 @@ -291,3 +291,10 @@ func (s *State) computeCollisionYXZ(bb, query AABB, vel path.Point, w World) (ou bb = bb.Offset(0, 0, outVel.Z) return bb, outVel } + +// AtLookTarget returns true if the player look position is actually at the +// given pitch and yaw. +func (s *State) AtLookTarget(yaw, pitch float64) bool { + dYaw, dPitch := math.Abs(modYaw(yaw, s.Yaw)), math.Abs(pitch-s.Pitch) + return dYaw <= 0.8 && dPitch <= 1.1 +}