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
This commit is contained in:
parent
ba501eebdf
commit
317c3ee707
@ -199,15 +199,15 @@ void Flyable::getLinearKartItemIntersection (const btVector3 origin, const Kart
|
|||||||
float dz = targetKartLoc.getZ() - origin.getZ();
|
float dz = targetKartLoc.getZ() - origin.getZ();
|
||||||
|
|
||||||
btTransform trans = target_kart->getTrans();
|
btTransform trans = target_kart->getTrans();
|
||||||
btVector3 target_direction(trans.getBasis()[0][1],
|
Vec3 target_direction(trans.getBasis()[0][1],
|
||||||
trans.getBasis()[1][1],
|
trans.getBasis()[1][1],
|
||||||
trans.getBasis()[2][1]);
|
trans.getBasis()[2][1]);
|
||||||
|
|
||||||
float gx = target_direction.getX();
|
float gx = target_direction.getX();
|
||||||
float gy = target_direction.getY();
|
float gy = target_direction.getY();
|
||||||
float gz = target_direction.getZ();
|
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
|
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;
|
*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;
|
*time_estimated = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,12 +259,12 @@ void Flyable::update(float dt)
|
|||||||
// unphysical, but feels right in the game.
|
// unphysical, but feels right in the game.
|
||||||
|
|
||||||
float delta = m_average_height - std::max(std::min(hat, m_max_height), m_min_height);
|
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 heading = atan2f(-v.getX(), v.getY());
|
||||||
float pitch = getTerrainPitch (heading);
|
float pitch = getTerrainPitch (heading);
|
||||||
float vel_z = m_force_updown*(delta);
|
float vel_z = m_force_updown*(delta);
|
||||||
if (hat < m_max_height) // take into account pitch of surface
|
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);
|
v.setZ(vel_z);
|
||||||
setVelocity(v);
|
setVelocity(v);
|
||||||
} // if m_adjust_z_velocity
|
} // if m_adjust_z_velocity
|
||||||
|
@ -138,12 +138,12 @@ void Plunger::update(float dt)
|
|||||||
// unphysical, but feels right in the game.
|
// unphysical, but feels right in the game.
|
||||||
|
|
||||||
float delta = m_average_height - std::max(std::min(hat, m_max_height), m_min_height);
|
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 heading = atan2f(-v.getX(), v.getY());
|
||||||
float pitch = getTerrainPitch (heading);
|
float pitch = getTerrainPitch (heading);
|
||||||
float vel_z = m_force_updown*(delta);
|
float vel_z = m_force_updown*(delta);
|
||||||
if (hat < m_max_height) // take into account pitch of surface
|
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);
|
v.setZ(vel_z);
|
||||||
setVelocity(v);
|
setVelocity(v);
|
||||||
} // update
|
} // update
|
||||||
|
Loading…
x
Reference in New Issue
Block a user