Moved check_structure detection from center of kart to the front
of the kart (which will work better for a photo finish). Hopefully no other side effect.
This commit is contained in:
parent
992c97258f
commit
425675bdac
@ -157,6 +157,10 @@ public:
|
|||||||
/** Returns true if this kart has no wheels. */
|
/** Returns true if this kart has no wheels. */
|
||||||
bool isWheeless() const;
|
bool isWheeless() const;
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the coordinates of the front of the kart. This is used for
|
||||||
|
* determining when the lap line is crossed. */
|
||||||
|
virtual const Vec3& getFrontXYZ() const = 0;
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the position of a wheel relative to the kart.
|
/** Returns the position of a wheel relative to the kart.
|
||||||
* \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear
|
* \param i Index of the wheel: 0=front right, 1 = front left, 2 = rear
|
||||||
* right, 3 = rear left. */
|
* right, 3 = rear left. */
|
||||||
|
@ -408,6 +408,8 @@ void Kart::reset()
|
|||||||
m_skidmarks->adjustFog(track->isFogEnabled() );
|
m_skidmarks->adjustFog(track->isFogEnabled() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec3 front(0, 0, getKartLength()*0.5f);
|
||||||
|
m_xyz_front = getTrans()(front);
|
||||||
|
|
||||||
m_terrain_info->update(getTrans());
|
m_terrain_info->update(getTrans());
|
||||||
|
|
||||||
@ -1190,6 +1192,9 @@ void Kart::update(float dt)
|
|||||||
m_body->getBroadphaseHandle()->m_collisionFilterGroup = 0;
|
m_body->getBroadphaseHandle()->m_collisionFilterGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec3 front(0, 0, getKartLength()*0.5f);
|
||||||
|
m_xyz_front = getTrans()(front);
|
||||||
|
|
||||||
m_terrain_info->update(getTrans(), epsilon);
|
m_terrain_info->update(getTrans(), epsilon);
|
||||||
if(m_body->getBroadphaseHandle())
|
if(m_body->getBroadphaseHandle())
|
||||||
{
|
{
|
||||||
|
@ -102,6 +102,10 @@ private:
|
|||||||
/** Current race position (1-num_karts). */
|
/** Current race position (1-num_karts). */
|
||||||
int m_race_position;
|
int m_race_position;
|
||||||
|
|
||||||
|
/** The coordinates of the front of the kart, used to determine when a
|
||||||
|
* new lap is triggered. */
|
||||||
|
Vec3 m_xyz_front;
|
||||||
|
|
||||||
/** True if the kart is eliminated. */
|
/** True if the kart is eliminated. */
|
||||||
bool m_eliminated;
|
bool m_eliminated;
|
||||||
|
|
||||||
@ -292,6 +296,10 @@ public:
|
|||||||
/** Returns the current position of this kart in the race. */
|
/** Returns the current position of this kart in the race. */
|
||||||
virtual int getPosition () const { return m_race_position; }
|
virtual int getPosition () const { return m_race_position; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the coordinates of the front of the kart. This is used for
|
||||||
|
* determining when the lap line is crossed. */
|
||||||
|
virtual const Vec3& getFrontXYZ() const { return m_xyz_front; }
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the initial position of this kart. */
|
/** Returns the initial position of this kart. */
|
||||||
virtual int getInitialPosition () const { return m_initial_position; }
|
virtual int getInitialPosition () const { return m_initial_position; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -174,7 +174,7 @@ void LinearWorld::update(float dt)
|
|||||||
// rescued or eliminated
|
// rescued or eliminated
|
||||||
if(kart->getKartAnimation()) continue;
|
if(kart->getKartAnimation()) continue;
|
||||||
|
|
||||||
kart_info.getTrackSector()->update(kart->getXYZ());
|
kart_info.getTrackSector()->update(kart->getFrontXYZ());
|
||||||
kart_info.m_overall_distance = kart_info.m_race_lap
|
kart_info.m_overall_distance = kart_info.m_race_lap
|
||||||
* m_track->getTrackLength()
|
* m_track->getTrackLength()
|
||||||
+ getDistanceDownTrackForKart(kart->getWorldKartId());
|
+ getDistanceDownTrackForKart(kart->getWorldKartId());
|
||||||
|
@ -100,7 +100,7 @@ void CheckStructure::update(float dt)
|
|||||||
World *world = World::getWorld();
|
World *world = World::getWorld();
|
||||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||||
{
|
{
|
||||||
const Vec3 &xyz = world->getKart(i)->getXYZ();
|
const Vec3 &xyz = world->getKart(i)->getFrontXYZ();
|
||||||
if(world->getKart(i)->getKartAnimation()) continue;
|
if(world->getKart(i)->getKartAnimation()) continue;
|
||||||
// Only check active checklines.
|
// Only check active checklines.
|
||||||
if(m_is_active[i] && isTriggered(m_previous_position[i], xyz, i))
|
if(m_is_active[i] && isTriggered(m_previous_position[i], xyz, i))
|
||||||
|
Loading…
Reference in New Issue
Block a user