Implement basic pathfinding

This commit is contained in:
Tom
2020-09-20 15:41:58 -07:00
parent 7d122e2f8b
commit 52f30dc402
5 changed files with 212 additions and 1 deletions

View File

@ -15,7 +15,7 @@ const (
resetVel = 0.003
maxYawChange = 33
maxPitchChange = 22
maxPitchChange = 11
gravity = 0.08
drag = 0.98
@ -91,6 +91,8 @@ func (s *State) surroundings(query AABB, w World) Surrounds {
func (s *State) applyLookInputs(input Inputs) {
errYaw := math.Min(math.Max(input.Yaw-s.Yaw, -maxYawChange), maxYawChange)
s.Yaw += errYaw
errPitch := math.Min(math.Max(input.Pitch-s.Pitch, -maxPitchChange), maxPitchChange)
s.Pitch += errPitch
}
func (s *State) applyPosInputs(input Inputs, acceleration, inertia float64) {