最终位置 = 起始位置 - 单位向量 * 射程长度 。
Point shootVector = nearestEnemy->sprite->getPosition() - this->getPosition(); Point normalizedShootVector = -shootVector.normalize(); auto farthestDistance = Director::getInstance()->getWinSize().width; Point overshotVector = normalizedShootVector * farthestDistance; Point offscreenPoint = (rotateArrow->getPosition() - overshotVector);
Point shootVector = nearestEnemy->sprite->getPosition() - this->getPosition(); Point normalizedShootVector = -shootVector.normalize(); auto farthestDistance = Director::getInstance()->getWinSize().width; Point overshotVector = normalizedShootVector * farthestDistance; Point offscreenPoint = (rotateArrow->getPosition() - overshotVector);