Use maximum height of a quad when determining if a kart is

on a quad or not. This fixes the problem that the AI can
not drive up the ramp in sandtrack.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11730 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-10-21 20:48:33 +00:00
parent f1e5f9a384
commit 0adcd00342
2 changed files with 9 additions and 3 deletions

View File

@ -44,6 +44,8 @@ Quad::Quad(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
m_center = 0.25f*(p0+p1+p2+p3);
m_min_height = std::min ( std::min(p0.getY(), p1.getY()),
std::min(p2.getY(), p3.getY()) );
m_max_height = std::max ( std::max(p0.getY(), p1.getY()),
std::max(p2.getY(), p3.getY()) );
m_invisible = invisible;
m_ai_ignore = ai_ignore;
@ -95,7 +97,7 @@ bool Quad::pointInQuad(const Vec3& p) const
// is taken into account, too. to simplify this test we only compare
// with the minimum height of the quad (and not with the actual
// height of the quad at the point where the kart is).
if(p.getY() - m_min_height > 5.0f ||
if(p.getY() - m_max_height > 5.0f ||
p.getY() - m_min_height < -1.0f )
return false;

View File

@ -47,6 +47,10 @@ private:
* are on top of each other when determining the sector a kart is on. */
float m_min_height;
/** The maximum height of the quad, used together with m_min_height
* to distinguish between quads which are on top of each other. */
float m_max_height;
/** Set to true if this quad should not be shown in the minimap. */
bool m_invisible;
@ -67,9 +71,9 @@ public:
const Vec3& getCenter () const {return m_center; }
// ------------------------------------------------------------------------
/** Returns the minimum height of a quad. */
float getMinHeight() const { return m_min_height; }
float getMinHeight() const { return m_min_height; }
// ------------------------------------------------------------------------
/** Returns true of this quad is invisible, i.e. not to be shown in
/** Returns true of this quad is invisible, i.e. not to be shown in
* the minimap. */
bool isInvisible() const { return m_invisible; }
// ------------------------------------------------------------------------