bool CombatSubsystem::GetProjectileLaunchAngles(Vector& launchAngles, const Vector& launchPoint, const float initialSpeed, const float gravity, const bool useHighTrajectory) const { Entity const* target = act->enemyManager->GetCurrentEnemy(); if (target) { auto targetPoint(target->centroid); Trajectory projectileTrajectory(launchPoint, targetPoint, initialSpeed, gravity * -sv_currentGravity->value, useHighTrajectory); if (projectileTrajectory.GetTravelTime() > 0.0f) { launchAngles.setPitch(projectileTrajectory.GetLaunchAngle()); auto direction(targetPoint - launchPoint); direction.z = 0.0f; direction.normalize(); launchAngles.setYaw(direction.toYaw()); launchAngles.setRoll(0.0f); return true; } } return false; }
void Turn::initialize(){ start = mouse->getPose(); goalYaw = toYaw(dir); }