Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inactive agents not included in collision computation #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions steerlib/include/interfaces/ObstacleInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ namespace SteerLib {
virtual float computePenetration(const Util::Point & p, float radius) = 0;
virtual std::pair<std::vector<Util::Point>,std::vector<size_t> > getStaticGeometry() = 0;
virtual std::vector<Util::Point> get2DStaticGeometry() = 0;
//always active
bool enabled() const { return true; }

public:
ObstacleInterface *nextObstacle_;
Expand Down
3 changes: 3 additions & 0 deletions steerlib/include/interfaces/SpatialDatabaseItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ namespace SteerLib {
// virtual bool overlaps(const SteerLib::SpatialDatabaseItemPtr item) = 0;
/// Returns the amount of penetration that a circle has if it overlaps, or 0.0 if there is no overlap.
virtual float computePenetration(const Util::Point & p, float radius) = 0;

///Returns false if item should not be included in spatial database calculation
virtual bool enabled() const = 0;
};

typedef SpatialDatabaseItem* SpatialDatabaseItemPtr;
Expand Down
5 changes: 5 additions & 0 deletions steerlib/include/testcaseio/TestCaseIOPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ namespace SteerLib {
virtual bool intersects(const Util::Ray &r, float &t) { return Util::rayIntersectsCircle2D(position, radius, r, t); }
virtual bool overlaps(const Util::Point & p, float r) { return Util::circleOverlapsCircle2D(position, radius, p, r); }
virtual float computePenetration(const Util::Point & p, float r) { return Util::computeCircleCirclePenetration2D(position, radius, p, r); }
//always active
bool enabled() const { return true; }
//@}
};

/// Temporary obstacle information used by the TestCaseReader internally during parsing and initialization.
class STEERLIB_API RawObstacleInfo : public SpatialDatabaseItem {
public:
//always active
bool enabled() const { return true; }

bool isObstacleRandom;
Util::AxisAlignedBox obstacleBounds;

Expand Down
5 changes: 4 additions & 1 deletion steerlib/src/AgentMetricsCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ void AgentMetricsCollector::_updateCollisionStats(SpatialDataBaseInterface * gri


for (neighbor = neighbors.begin(); neighbor != neighbors.end(); ++neighbor) {

//dont include those items who are not active
if (!(*neighbor)->enabled())
continue;

// this way, collisionKey will be unique across all objects in the spatial database.

// MUBBASIR -- THIS CAUSES A COMPILE PROBLEM ON HAMMERHEAD
Expand Down