cleanup in cakes to remove some missile leftovers

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2403 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-10-30 18:40:41 +00:00
parent c4e27f1a7a
commit 8cf03a0703
3 changed files with 2 additions and 18 deletions

View File

@ -9,7 +9,6 @@
(max-height 1.0) (max-height 1.0)
(force-updown 25.0) ;; force raising/lowering the homing missile if it's too low/high (force-updown 25.0) ;; force raising/lowering the homing missile if it's too low/high
(max-distance 90.0) ;; maximum distance at which a kart is still followed (max-distance 90.0) ;; maximum distance at which a kart is still followed
(max-turn-angle 65.0) ;; maximum turn angle when following a kart
) )
;; EOF ;; ;; EOF ;;

View File

@ -24,7 +24,6 @@
float Cake::m_st_max_distance; float Cake::m_st_max_distance;
float Cake::m_st_max_distance_squared; float Cake::m_st_max_distance_squared;
float Cake::m_st_max_turn_angle;
Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE) Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
{ {
@ -53,8 +52,7 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
if(closest_kart != NULL && kartDistSquared < m_st_max_distance_squared && m_speed>closest_kart->getSpeed()) if(closest_kart != NULL && kartDistSquared < m_st_max_distance_squared && m_speed>closest_kart->getSpeed())
{ {
m_target = (Kart*)closest_kart; m_target = (Kart*)closest_kart;
//std::cout << "aiming at " << closest_kart->getName().c_str() << std::endl;
// calculate appropriate initial up velocity so that the // calculate appropriate initial up velocity so that the
// projectile lands on the aimed kart (9.8 is the gravity) // projectile lands on the aimed kart (9.8 is the gravity)
const float time = sqrt(kartDistSquared) / (m_speed - closest_kart->getSpeed()/2.5f); // the division is an empirical estimation const float time = sqrt(kartDistSquared) / (m_speed - closest_kart->getSpeed()/2.5f); // the division is an empirical estimation
@ -86,14 +84,6 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
// kart is too far to be hit. so throw the projectile in a generic way, // kart is too far to be hit. so throw the projectile in a generic way,
// straight ahead, without trying to hit anything in particular // straight ahead, without trying to hit anything in particular
trans = kart->getKartHeading(pitch); trans = kart->getKartHeading(pitch);
/*
std::cout << "Using generic direction because ";
if(closest_kart == NULL) std::cout << "no closest kart was found ";
else if(!(kartDistSquared < m_st_max_distance_squared)) std::cout << closest_kart->getName().c_str() << " is too far : " << sqrt(kartDistSquared) << " (" << kartDistSquared << ")";
if(closest_kart != NULL && !(m_speed>closest_kart->getSpeed())) std::cout << "kart is too fast ";
std::cout << std::endl;
*/
} }
@ -101,8 +91,7 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
createPhysics(y_offset, m_initial_velocity, createPhysics(y_offset, m_initial_velocity,
new btCylinderShape(0.5f*m_extend), true /* gravity */, true /* rotation */, &trans); new btCylinderShape(0.5f*m_extend), true /* gravity */, true /* rotation */, &trans);
// m_body->setCollisionFlags(m_body->getCollisionFlags() |
// btCollisionObject::CF_KINEMATIC_OBJECT );
m_body->setActivationState(DISABLE_DEACTIVATION); m_body->setActivationState(DISABLE_DEACTIVATION);
m_body->applyTorque( btVector3(5,-3,7) ); m_body->applyTorque( btVector3(5,-3,7) );
@ -113,14 +102,11 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
void Cake::init(const lisp::Lisp* lisp, ssgEntity *cake_model) void Cake::init(const lisp::Lisp* lisp, ssgEntity *cake_model)
{ {
Flyable::init(lisp, cake_model, POWERUP_CAKE); Flyable::init(lisp, cake_model, POWERUP_CAKE);
m_st_max_turn_angle = 15.0f;
m_st_max_distance = 80.0f; m_st_max_distance = 80.0f;
m_st_max_distance_squared = 80.0f * 80.0f; m_st_max_distance_squared = 80.0f * 80.0f;
lisp->get("max-distance", m_st_max_distance ); lisp->get("max-distance", m_st_max_distance );
m_st_max_distance_squared = m_st_max_distance*m_st_max_distance; m_st_max_distance_squared = m_st_max_distance*m_st_max_distance;
lisp->get("max-turn-angle", m_st_max_turn_angle);
} // init } // init
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -27,7 +27,6 @@ class Cake : public Flyable
private: private:
static float m_st_max_distance; // maximum distance for a missile to be attracted static float m_st_max_distance; // maximum distance for a missile to be attracted
static float m_st_max_distance_squared; static float m_st_max_distance_squared;
static float m_st_max_turn_angle;
btVector3 m_initial_velocity; btVector3 m_initial_velocity;
//float steerTowards(btTransform& trans, btVector3& target); //float steerTowards(btTransform& trans, btVector3& target);