Added reasons to assertions
This commit is contained in:
@ -25,8 +25,8 @@ bool_t SolidController2D::getCollidingResult(
|
||||
glm::vec2 &entryPoint,
|
||||
glm::vec2 &exitPoint
|
||||
) {
|
||||
assertNotNull(this->collider);
|
||||
assertNotNull(movingObject);
|
||||
assertNotNull(this->collider, "SolidController2D::getCollidingResult: Collider cannot be null");
|
||||
assertNotNull(movingObject, "SolidController2D::getCollidingResult: Moving object cannot be null");
|
||||
if(movement.x == 0 && movement.y == 0) return false;
|
||||
|
||||
auto myPos = physics3Dto2D(movingObject->transform->getWorldPosition());
|
||||
@ -35,13 +35,13 @@ bool_t SolidController2D::getCollidingResult(
|
||||
switch(movingObject->getColliderType()) {
|
||||
case COLLIDER2D_TYPE_BOX: {
|
||||
auto box1 = dynamic_cast<BoxCollider*>(movingObject);
|
||||
assertNotNull(box1);
|
||||
assertNotNull(box1, "SolidController2D::getCollidingResult: Moving object is not a BoxCollider");
|
||||
|
||||
// Box VS (this)?
|
||||
switch(this->collider->getColliderType()) {
|
||||
case COLLIDER2D_TYPE_BOX: {
|
||||
auto box2 = dynamic_cast<BoxCollider*>(this->collider);
|
||||
assertNotNull(box2);
|
||||
assertNotNull(box2, "SolidController2D::getCollidingResult: Collider is not a BoxCollider");
|
||||
auto otherPos = physics3Dto2D(box2->transform->getWorldPosition());
|
||||
|
||||
return boxCheckCollision(
|
||||
@ -53,17 +53,17 @@ bool_t SolidController2D::getCollidingResult(
|
||||
}
|
||||
|
||||
default: {
|
||||
assertUnreachable();
|
||||
assertUnreachable("SolidController2D::getCollidingResult: Collider type not implemented");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
assertUnreachable();
|
||||
assertUnreachable("SolidController2D::getCollidingResult: Moving object type not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
assertUnreachable();
|
||||
assertUnreachable("SolidController2D::getCollidingResult: Should never reach this point");
|
||||
return false;
|
||||
}
|
@ -18,19 +18,19 @@ std::vector<SceneItemComponent*> TriggerController2D::getDependencies() {
|
||||
}
|
||||
|
||||
bool_t TriggerController2D::getCollidingResult(Collider2D* movingObject) {
|
||||
assertNotNull(this->collider);
|
||||
assertNotNull(movingObject);
|
||||
assertNotNull(this->collider, "TriggerController2D::getCollidingResult: Collider cannot be null");
|
||||
assertNotNull(movingObject, "TriggerController2D::getCollidingResult: Moving object cannot be null");
|
||||
|
||||
switch(movingObject->getColliderType()) {
|
||||
case COLLIDER2D_TYPE_BOX: {
|
||||
auto box1 = dynamic_cast<BoxCollider*>(movingObject);
|
||||
assertNotNull(box1);
|
||||
assertNotNull(box1, "TriggerController2D::getCollidingResult: Moving object is not a BoxCollider");
|
||||
|
||||
// Box VS ?
|
||||
switch(collider->getColliderType()) {
|
||||
case COLLIDER2D_TYPE_BOX: {
|
||||
auto box2 = dynamic_cast<BoxCollider*>(collider);
|
||||
assertNotNull(box2);
|
||||
assertNotNull(box2, "TriggerController2D::getCollidingResult: Collider is not a BoxCollider");
|
||||
return boxIsBoxColliding(
|
||||
physics3Dto2D(box1->transform->getWorldPosition()), box1->min, box1->max,
|
||||
physics3Dto2D(box2->transform->getWorldPosition()), box2->min, box2->max
|
||||
@ -38,13 +38,13 @@ bool_t TriggerController2D::getCollidingResult(Collider2D* movingObject) {
|
||||
}
|
||||
|
||||
default: {
|
||||
assertUnreachable();
|
||||
assertUnreachable("TriggerController2D::getCollidingResult: Collider type not implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default: {
|
||||
assertUnreachable();
|
||||
assertUnreachable("TriggerController2D::getCollidingResult: Moving object type not implemented");
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ bool_t CapsuleCollider::performRaycast(
|
||||
struct Collider3DRayResult *result,
|
||||
struct Ray3D ray
|
||||
) {
|
||||
assertNotNull(result);
|
||||
assertNotNull(result, "CapsuleCollider::performRaycast: Result cannot be null");
|
||||
|
||||
return raytestCapsule(
|
||||
ray,
|
||||
|
@ -15,7 +15,7 @@ bool_t Collider3D::raycast(
|
||||
struct Collider3DRayResult *result,
|
||||
struct Ray3D ray
|
||||
) {
|
||||
assertNotNull(result);
|
||||
assertNotNull(result, "Collider3D::raycast: Result cannot be null");
|
||||
if(!this->performRaycast(result, ray)) return false;
|
||||
result->collider = this;
|
||||
return true;
|
||||
|
@ -15,7 +15,7 @@ bool_t CubeCollider::performRaycast(
|
||||
struct Collider3DRayResult *result,
|
||||
struct Ray3D ray
|
||||
) {
|
||||
assertNotNull(result);
|
||||
assertNotNull(result, "CubeCollider::performRaycast: Result cannot be null");
|
||||
|
||||
return Dawn::raytestCube(
|
||||
ray,
|
||||
|
@ -19,7 +19,7 @@ bool_t SphereCollider::performRaycast(
|
||||
struct Collider3DRayResult *result,
|
||||
struct Ray3D ray
|
||||
) {
|
||||
assertNotNull(result);
|
||||
assertNotNull(result, "SphereCollider::performRaycast: Result cannot be null");
|
||||
|
||||
return raytestSphere(
|
||||
ray,
|
||||
|
Reference in New Issue
Block a user