Bugfix for 2354315: items explode over void.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3839 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2009-08-12 00:14:51 +00:00
parent 4439e7df49
commit bd2c6c27b5
3 changed files with 24 additions and 13 deletions

View File

@@ -245,7 +245,13 @@ void Flyable::update(float dt)
Vec3 pos=getBody()->getWorldTransform().getOrigin();
TerrainInfo::update(pos);
if(getHoT()==Track::NOHIT)
// Check if the flyable is outside of the track. If so, explode it.
const Vec3 *min, *max;
race_manager->getTrack()->getAABB(&min, &max);
Vec3 xyz = getXYZ();
if(xyz[0]<(*min)[0] || xyz[1]<(*min)[1] || xyz[2]<(*min)[2] ||
xyz[0]>(*max)[0] || xyz[1]>(*max)[1] )
{
hit(NULL); // flyable out of track boundary
return;

View File

@@ -439,9 +439,8 @@ bool Track::loadMainTrack(const XMLNode &xml_node)
m_all_meshes.push_back(mesh);
Vec3 min, max;
MeshTools::minMax3D(mesh, &min, &max);
RaceManager::getWorld()->getPhysics()->init(min, max);
MeshTools::minMax3D(mesh, &m_aabb_min, &m_aabb_max);
RaceManager::getWorld()->getPhysics()->init(m_aabb_min, m_aabb_max);
// This will (at this stage) only convert the main track model.
convertTrackToBullet(mesh);
if (m_track_mesh == NULL)

View File

@@ -70,6 +70,10 @@ private:
bool m_has_final_camera;
Vec3 m_camera_final_position;
Vec3 m_camera_final_hpr;
/** Minimum coordinates of this track. */
Vec3 m_aabb_min;
/** Maximum coordinates of this track. */
Vec3 m_aabb_max;
bool m_is_arena;
int m_version;
@@ -116,14 +120,14 @@ private:
/** The texture for the mini map, which is displayed in the race gui. */
video::ITexture *m_mini_map;
/** List of all bezier curves in the track - for e.g. camera, ... */
std::vector<BezierCurve*> m_all_curves;
/** List of all bezier curves in the track - for e.g. camera, ... */
std::vector<BezierCurve*> m_all_curves;
/** Animation manager. */
AnimationManager *m_animation_manager;
/** Animation manager. */
AnimationManager *m_animation_manager;
/** Checkline manager. */
CheckManager *m_check_manager;
/** Checkline manager. */
CheckManager *m_check_manager;
void loadTrack(const std::string &filename);
void itemCommand(const Vec3 &xyz, Item::ItemType item_type,
@@ -134,7 +138,7 @@ private:
void createWater(const XMLNode &node);
void getMusicInformation(std::vector<std::string>& filenames,
std::vector<MusicInformation*>& m_music );
void loadCurves(const XMLNode &node);
void loadCurves(const XMLNode &node);
void handleAnimatedTextures(scene::ISceneNode *node, const XMLNode &xml);
public:
@@ -192,9 +196,11 @@ public:
float getTerrainHeight(const Vec3 &pos) const;
void createPhysicsModel();
void update(float dt);
void reset();
void reset();
void handleExplosion(const Vec3 &pos, const PhysicalObject *mp) const;
/** Sets pointer to the aabb of this track. */
void getAABB(const Vec3 **min, const Vec3 **max) const
{ *min = &m_aabb_min; *max = &m_aabb_max; }
/** Returns the graph of quads, mainly for the AI. */
const QuadGraph& getQuadGraph() const { return *m_quad_graph; }