def getForward(self): """Return this vehicle's forward direction, a unit vector (SteerVec). """ forward = SteerVec(self._velocity.getX(), self._velocity.getY()) forward.normalize() return forward
def getForward(self): """Return this vehicle's forward direction, a unit vector (SteerVec). """ forward = SteerVec(self._velocity.getX(),self._velocity.getY()) forward.normalize() return forward
def _steerForFollow(self, target=None): """Return the steering_direction (SteerVec) required to follow target. target should be another Vehicle. Follow is like the pursue behavior but the vehicle will follow behind its target instead of catching up to it. The arrive behavior is place of seek in pursuit""" if target == None: target = self._target direction = SteerVec(target._velocity.getX(), target._velocity.getY()) direction.normalize() point = target._pos + direction * -5 return self._steerForArrive(point)
def _steerForFollow(self, target=None): """Return the steering_direction (SteerVec) required to follow target. target should be another Vehicle. Follow is like the pursue behavior but the vehicle will follow behind its target instead of catching up to it. The arrive behavior is place of seek in pursuit""" if target == None: target = self._target direction = SteerVec(target._velocity.getX(),target._velocity.getY()) direction.normalize() point = target._pos + direction*-5 return self._steerForArrive(point)