Add new bullet trajectories
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
module Dodge.Movement.Turn where
|
||||
import Geometry
|
||||
|
||||
turnTo :: Float -> Point2 -> Point2 -> Float -> Float
|
||||
turnTo turnSpeed sp tp a
|
||||
| vToTarg == V2 0 0 = a
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
= argV vToTarg
|
||||
| isLHS (sp +.+ vdir) sp tp = a - turnSpeed
|
||||
| otherwise = a + turnSpeed
|
||||
where
|
||||
vdir = unitVectorAtAngle a
|
||||
vToTarg = tp -.- sp
|
||||
|
||||
vecTurnTo :: Float -> Point2 -> Point2 -> Point2 -> Point2
|
||||
vecTurnTo turnSpeed sp tp vdir
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
= argV vdir *.* normalizeV vToTarg
|
||||
| isLHS (sp +.+ vdir) sp tp = rotateV (negate turnSpeed) vdir
|
||||
| otherwise = rotateV turnSpeed vdir
|
||||
where
|
||||
vToTarg = tp -.- sp
|
||||
Reference in New Issue
Block a user