Implement tracking rockets
This commit is contained in:
@@ -12,6 +12,17 @@ turnTo turnSpeed sp tp a
|
||||
vdir = unitVectorAtAngle a
|
||||
vToTarg = tp -.- sp
|
||||
|
||||
turnToAmount :: Float -> Point2 -> Point2 -> Float -> Float
|
||||
turnToAmount turnSpeed sp tp a
|
||||
| vToTarg == V2 0 0 = 0
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
= diffAngles a (argV vToTarg) -- TODO check correctness
|
||||
| isLHS (sp +.+ vdir) sp tp = negate turnSpeed
|
||||
| otherwise = turnSpeed
|
||||
where
|
||||
vdir = unitVectorAtAngle a
|
||||
vToTarg = tp -.- sp
|
||||
|
||||
vecTurnTo :: Float -> Point2 -> Point2 -> Point2 -> Point2
|
||||
vecTurnTo turnSpeed sp tp vdir
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
|
||||
Reference in New Issue
Block a user