bool Positionable::intersectsWith(Positionable other) const {
if ((position.x + size.x >= other.getPosition().x) &&
(position.x <= other.getPosition().x + other.getSize().x) &&
(position.y + size.y >= other.getPosition().y) &&
(position.y <= other.getPosition().y + other.getPosition().y) &&
(position.z + size.z >= other.getPosition().z) &&
(position.z <= other.getPosition().z + other.getSize().z)) {
return true;
} else {
return false;
}
}
Positionable is a class that has a position, a size, and a rotation (all of which are of another class called Vector3).Questions:
a) I've heard that when you start adding lots of objects, this method of collision detection will slow down the game drastically. Is that true? Does anyone have a better method?
b) How would I have this account for the rotation as well? The rotation is stored as 3 angles, one for each axis.
Thanks.






