int ColBuf::handleIt(bool colX, bool colY, bool colZ){ addDimCol(x, colX); addDimCol(y, colY); addDimCol(z, colZ); if (collisionDetected()) return last(); return 0; }
char ColBuf::handleCollision(bool colX, bool colY, bool colZ){ addDimCol(x, colX); addDimCol(y, colY); addDimCol(z, colZ); if (collisionDetected()){ int l = last(); if (l==x) return 'x'; if (l==y) return 'y'; if (l==z) return 'z'; } return (char)0; }
void MetalineEnemy::checkForCollision() { if (collisionDetected()) { hasCollided = true; this->center.x -= this->velocity[0]; this->center.y -= this->velocity[1]; this->center.z -= this->velocity[2]; Vertex direction = generateRandomNormalizedDirection(); this->velocity = Vec3f(direction.x * this->speed, direction.y * this->speed, direction.z * this->speed); } else { hasCollided = false; } }
void CollisionSensor::BeginContact(b2Contact *contact) { emit collisionDetected(); }