possibly fixed aiming issues when throwing plunger backwards
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2807 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
488e5a4aab
commit
6d2292f3c7
@ -54,11 +54,16 @@ Plunger::Plunger(Kart *kart) : Flyable(kart, POWERUP_PLUNGER)
|
||||
// aim at this kart if it's not too far
|
||||
if(closest_kart != NULL && kartDistSquared < 30*30)
|
||||
{
|
||||
btVector3 closestKartLoc = closest_kart->getTrans().getOrigin();
|
||||
|
||||
if(!m_reverse_mode)
|
||||
{
|
||||
// FIXME - this approximation will be wrong if both karts' directions are not colinear
|
||||
const float time = sqrt(kartDistSquared) / (m_speed - closest_kart->getSpeed());
|
||||
|
||||
// calculate the approximate location of the aimed kart in 'time' seconds
|
||||
btVector3 closestKartLoc = closest_kart->getTrans().getOrigin();
|
||||
closestKartLoc += time*closest_kart->getVelocity();
|
||||
}
|
||||
|
||||
// calculate the angle at which the projectile should be thrown
|
||||
// to hit the aimed kart
|
||||
|
Loading…
Reference in New Issue
Block a user