コード例 #1
0
bool Collisionhandler::testOBBOverlap(Entity &a, Entity &b) {
  if (b.getType() == Entity::NOTCOLLIDABLE) {
    return false;
  }

  OBB aOBB = createOBB(a);
  OBB bOBB = createOBB(b);

  bool didCollide = overlaps(aOBB, bOBB) && overlaps(bOBB, aOBB);
  if (didCollide) {
    a.handleCollision(b);
    b.handleCollision(a);
  }
  return didCollide;
}
コード例 #2
0
ファイル: GoalOBB.cpp プロジェクト: MengeCrowdSim/Menge
bool OBBGoalFactory::setFromXML(Goal* goal, TiXmlElement* node,
                                const std::string& behaveFldr) const {
  OBBGoal* obbGoal = dynamic_cast<OBBGoal*>(goal);
  assert(obbGoal != 0x0 && "Trying to set OBB goal attributes on an incompatible object.");
  if (!GoalFactory::setFromXML(obbGoal, node, behaveFldr)) return false;

  // rely on createOBB to parse errors
  OBBShape* geometry = createOBB(node);
  if (geometry != 0x0) {
    goal->setGeometry(geometry);
    return true;
  }
  return false;
}