From 317c3ee70792fbdfacb6c9f646081b2b2b4cc250 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Mon, 20 Jul 2009 04:07:54 +0000 Subject: [PATCH] Fixed VS compilation issues (hypotf is not supported for non-Itanium platforms, and the corresponding Vec3 function makes it easier if in the future we decide to change the orientation of the bullet coordinate system). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3777 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/items/flyable.cpp | 16 ++++++++-------- src/items/plunger.cpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/items/flyable.cpp b/src/items/flyable.cpp index 03b584a52..3e14067e4 100644 --- a/src/items/flyable.cpp +++ b/src/items/flyable.cpp @@ -199,15 +199,15 @@ void Flyable::getLinearKartItemIntersection (const btVector3 origin, const Kart float dz = targetKartLoc.getZ() - origin.getZ(); btTransform trans = target_kart->getTrans(); - btVector3 target_direction(trans.getBasis()[0][1], - trans.getBasis()[1][1], - trans.getBasis()[2][1]); + Vec3 target_direction(trans.getBasis()[0][1], + trans.getBasis()[1][1], + trans.getBasis()[2][1]); float gx = target_direction.getX(); float gy = target_direction.getY(); float gz = target_direction.getZ(); - - float target_kart_speed = hypotf(gx, gy) * target_kart->getSpeed(); //Projected onto X-Y plane + + float target_kart_speed = target_direction.length_2d() * target_kart->getSpeed(); //Projected onto X-Y plane float target_kart_heading = atan2f(-gx, gy); //anti-clockwise @@ -231,7 +231,7 @@ void Flyable::getLinearKartItemIntersection (const btVector3 origin, const Kart *fire_angle = fire_th; - *up_velocity = (0.5 * time * gravity) + (dz / time) + (gz * target_kart->getSpeed()); + *up_velocity = (0.5f * time * gravity) + (dz / time) + (gz * target_kart->getSpeed()); *time_estimated = time; } @@ -259,12 +259,12 @@ void Flyable::update(float dt) // unphysical, but feels right in the game. float delta = m_average_height - std::max(std::min(hat, m_max_height), m_min_height); - btVector3 v = getVelocity(); + Vec3 v = getVelocity(); float heading = atan2f(-v.getX(), v.getY()); float pitch = getTerrainPitch (heading); float vel_z = m_force_updown*(delta); if (hat < m_max_height) // take into account pitch of surface - vel_z += hypotf(v.getX(), v.getY())*tanf(pitch); + vel_z += v.length_2d()*tanf(pitch); v.setZ(vel_z); setVelocity(v); } // if m_adjust_z_velocity diff --git a/src/items/plunger.cpp b/src/items/plunger.cpp index 447a4be96..ba7645eac 100644 --- a/src/items/plunger.cpp +++ b/src/items/plunger.cpp @@ -138,12 +138,12 @@ void Plunger::update(float dt) // unphysical, but feels right in the game. float delta = m_average_height - std::max(std::min(hat, m_max_height), m_min_height); - btVector3 v = getVelocity(); + Vec3 v = getVelocity(); float heading = atan2f(-v.getX(), v.getY()); float pitch = getTerrainPitch (heading); float vel_z = m_force_updown*(delta); if (hat < m_max_height) // take into account pitch of surface - vel_z += hypotf(v.getX(), v.getY())*tanf(pitch); + vel_z += v.length_2d()*tanf(pitch); v.setZ(vel_z); setVelocity(v); } // update