Avoid raycasts when being outside of the track (which caused at least one crash,

though the reason for this crash are still unclear, since the code logic
should prevent the assertion that happened. See bug 2974314 for details).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5050 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-03-23 23:33:47 +00:00
parent 7bedccbd82
commit a2c524a4eb

View File

@ -280,22 +280,22 @@ void Flyable::update(float dt)
if(m_exploded) return;
Vec3 pos=getBody()->getWorldTransform().getOrigin();
TerrainInfo::update(pos);
Vec3 xyz=getBody()->getWorldTransform().getOrigin();
// Check if the flyable is outside of the track. If so, explode it.
const Vec3 *min, *max;
World::getWorld()->getTrack()->getAABB(&min, &max);
Vec3 xyz = getXYZ();
if(xyz[0]<(*min)[0] || xyz[2]<(*min)[2] || xyz[1]<(*min)[1] ||
xyz[0]>(*max)[0] || xyz[2]>(*max)[2] )
{
hit(NULL); // flyable out of track boundary
return;
}
TerrainInfo::update(xyz);
if(m_adjust_up_velocity)
{
float hat = pos.getY()-getHoT();
float hat = xyz.getY()-getHoT();
// Use the Height Above Terrain to set the Z velocity.
// HAT is clamped by min/max height. This might be somewhat