Use more realistic yaw/pitch speeds
This commit is contained in:
@ -17,8 +17,8 @@ const (
|
|||||||
playerHeight = 1.8
|
playerHeight = 1.8
|
||||||
resetVel = 0.003
|
resetVel = 0.003
|
||||||
|
|
||||||
maxYawChange = 18
|
maxYawChange = 7
|
||||||
maxPitchChange = 11
|
maxPitchChange = 5
|
||||||
|
|
||||||
stepHeight = 0.6
|
stepHeight = 0.6
|
||||||
minJumpTicks = 14
|
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)
|
bb = bb.Offset(0, 0, outVel.Z)
|
||||||
return bb, outVel
|
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
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user