More fixes to swap the bullet axis.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/switch_coordinate_system@4822 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-02-24 05:23:00 +00:00
parent 092a59a7d2
commit fbeaa0524f
7 changed files with 20 additions and 6 deletions

View File

@ -269,7 +269,11 @@ void Camera::update(float dt)
{ {
Vec3 wanted_position; Vec3 wanted_position;
Vec3 wanted_target = m_kart->getXYZ(); Vec3 wanted_target = m_kart->getXYZ();
Vec3 rotated_forw=m_kart->getTrans().getBasis()*Vec3(0,0,1);
float heading=atan2f(-rotated_forw.getX(), rotated_forw.getZ());
printf("kart hpr %f (%f) %f %f\n",
m_kart->getHPR().getX(),heading, m_kart->getHPR().getY(),
m_kart->getHPR().getZ());
// Each case should set wanted_position and wanted_target according to // Each case should set wanted_position and wanted_target according to
// what is needed for that mode. Yes, there is a lot of duplicate code // what is needed for that mode. Yes, there is a lot of duplicate code
// but it is (IMHO) much easier to follow this way. // but it is (IMHO) much easier to follow this way.

View File

@ -645,7 +645,6 @@ void Kart::update(float dt)
else else
m_uprightConstraint->setLimit(m_kart_properties->getUprightTolerance()); m_uprightConstraint->setLimit(m_kart_properties->getUprightTolerance());
m_zipper_time_left = m_zipper_time_left>0.0f ? m_zipper_time_left-dt : 0.0f; m_zipper_time_left = m_zipper_time_left>0.0f ? m_zipper_time_left-dt : 0.0f;
//m_wheel_rotation gives the rotation around the X-axis, and since velocity's //m_wheel_rotation gives the rotation around the X-axis, and since velocity's

View File

@ -136,6 +136,17 @@ void Moveable::update(float dt)
//Vec3 roll_vec = m_transform.getBasis()*up; //Vec3 roll_vec = m_transform.getBasis()*up;
//float roll = atan2(roll_vec.getX(), roll_vec.getY()); //float roll = atan2(roll_vec.getX(), roll_vec.getY());
//m_hpr.setRoll(roll); //m_hpr.setRoll(roll);
Vec3 up(0, 1, 0);
Vec3 pitch_vec = m_transform.getBasis()*up;
float p = atan2f(pitch_vec.getZ(), pitch_vec.getY());
float r = atan2f(pitch_vec.getX(), pitch_vec.getY());
Vec3 forw(0,0,1);
Vec3 forw_vec = m_transform.getBasis()*forw;
float h = atan2f(forw_vec.getX(), forw_vec.getZ());
printf("orig: %f %f %f now %f %f %f\n",
m_hpr.getX(), m_hpr.getY(), m_hpr.getZ(), h, p, r);
//m_hpr = Vec3(h, p, r);
//m_hpr.setPitch(p);
updateGraphics(Vec3(0,0,0), Vec3(0,0,0)); updateGraphics(Vec3(0,0,0), Vec3(0,0,0));
m_first_time = false ; m_first_time = false ;

View File

@ -304,7 +304,7 @@ void World::resetAllKarts()
for ( KartList::iterator i=m_karts.begin(); i!=m_karts.end(); i++) for ( KartList::iterator i=m_karts.begin(); i!=m_karts.end(); i++)
{ {
///start projection from top of kart ///start projection from top of kart
btVector3 up_offset(0, 0, 0.5f * ((*i)->getKartHeight())); btVector3 up_offset(0, 0.5f * ((*i)->getKartHeight()), 0);
(*i)->getVehicle()->getRigidBody()->translate (up_offset); (*i)->getVehicle()->getRigidBody()->translate (up_offset);
bool kart_over_ground = m_physics->projectKartDownwards(*i); bool kart_over_ground = m_physics->projectKartDownwards(*i);

View File

@ -154,7 +154,7 @@ void Physics::update(float dt)
bool Physics::projectKartDownwards(const Kart *k) bool Physics::projectKartDownwards(const Kart *k)
{ {
btVector3 hell(0, 0, -10000); btVector3 hell(0, -10000, 0);
return k->getVehicle()->projectVehicleToSurface(hell, true /*allow translation*/); return k->getVehicle()->projectVehicleToSurface(hell, true /*allow translation*/);
} //projectKartsDownwards } //projectKartsDownwards

View File

@ -664,7 +664,7 @@ public:
// Random kart // Random kart
scene::IMesh* model = item_manager->getItemModel(Item::ITEM_BONUS_BOX); scene::IMesh* model = item_manager->getItemModel(Item::ITEM_BONUS_BOX);
w3->clearModels(); w3->clearModels();
w3->addModel( model, Vec3(0.0f, 0.0f, -12.0f) ); w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f) );
w3->update(0); w3->update(0);
m_parent->m_kart_widgets[playerID].kartName->setText( _("Random Kart") ); m_parent->m_kart_widgets[playerID].kartName->setText( _("Random Kart") );
} }

View File

@ -918,7 +918,7 @@ void Track::getTerrainInfo(const Vec3 &pos, float *hot, Vec3 *normal,
const Material **material) const const Material **material) const
{ {
btVector3 to_pos(pos); btVector3 to_pos(pos);
to_pos.setZ(-100000.f); to_pos.setY(-100000.f);
class MaterialCollision : public btCollisionWorld::ClosestRayResultCallback class MaterialCollision : public btCollisionWorld::ClosestRayResultCallback
{ {