bool PhysicsEntity::findPlaneCollisions(const glm::vec4& plane, CollisionList& collisions) { bool collided = false; PlaneShape planeShape(plane); for (int i = 0; i < _shapes.size(); i++) { if (_shapes.at(i) && ShapeCollider::collideShapes(&planeShape, _shapes.at(i), collisions)) { CollisionInfo* collision = collisions.getLastCollision(); collision->_data = (void*)(this); collision->_intData = i; collided = true; } } return collided; }
bool PhysicsEntity::findSphereCollisions(const glm::vec3& sphereCenter, float sphereRadius, CollisionList& collisions) { bool collided = false; SphereShape sphere(sphereRadius, sphereCenter); for (int i = 0; i < _shapes.size(); i++) { Shape* shape = _shapes[i]; if (!shape) { continue; } if (ShapeCollider::collideShapes(&sphere, shape, collisions)) { CollisionInfo* collision = collisions.getLastCollision(); collision->_data = (void*)(this); collision->_intData = i; collided = true; } } return collided; }