mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 05:07:12 +01:00
Improve collision exception error messages for easier understanding
This commit is contained in:
parent
13e1941f87
commit
cbcd6bad4a
@ -86,14 +86,14 @@ Array PhysicsBody2D::get_collision_exceptions() {
|
|||||||
void PhysicsBody2D::add_collision_exception_with(Node *p_node) {
|
void PhysicsBody2D::add_collision_exception_with(Node *p_node) {
|
||||||
ERR_FAIL_NULL(p_node);
|
ERR_FAIL_NULL(p_node);
|
||||||
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
|
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
|
||||||
ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type.");
|
ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
|
||||||
Physics2DServer::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid());
|
Physics2DServer::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsBody2D::remove_collision_exception_with(Node *p_node) {
|
void PhysicsBody2D::remove_collision_exception_with(Node *p_node) {
|
||||||
ERR_FAIL_NULL(p_node);
|
ERR_FAIL_NULL(p_node);
|
||||||
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
|
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
|
||||||
ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type.");
|
ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
|
||||||
Physics2DServer::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid());
|
Physics2DServer::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,14 +76,14 @@ Array PhysicsBody::get_collision_exceptions() {
|
|||||||
void PhysicsBody::add_collision_exception_with(Node *p_node) {
|
void PhysicsBody::add_collision_exception_with(Node *p_node) {
|
||||||
ERR_FAIL_NULL(p_node);
|
ERR_FAIL_NULL(p_node);
|
||||||
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
||||||
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
|
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two nodes that inherit from CollisionObject (such as Area or PhysicsBody).");
|
||||||
PhysicsServer::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid());
|
PhysicsServer::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsBody::remove_collision_exception_with(Node *p_node) {
|
void PhysicsBody::remove_collision_exception_with(Node *p_node) {
|
||||||
ERR_FAIL_NULL(p_node);
|
ERR_FAIL_NULL(p_node);
|
||||||
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
||||||
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
|
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two nodes that inherit from CollisionObject (such as Area or PhysicsBody).");
|
||||||
PhysicsServer::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid());
|
PhysicsServer::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,14 +618,14 @@ Array SoftBody::get_collision_exceptions() {
|
|||||||
void SoftBody::add_collision_exception_with(Node *p_node) {
|
void SoftBody::add_collision_exception_with(Node *p_node) {
|
||||||
ERR_FAIL_NULL(p_node);
|
ERR_FAIL_NULL(p_node);
|
||||||
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
||||||
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
|
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two nodes that inherit from CollisionObject (such as Area or PhysicsBody).");
|
||||||
PhysicsServer::get_singleton()->soft_body_add_collision_exception(physics_rid, collision_object->get_rid());
|
PhysicsServer::get_singleton()->soft_body_add_collision_exception(physics_rid, collision_object->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftBody::remove_collision_exception_with(Node *p_node) {
|
void SoftBody::remove_collision_exception_with(Node *p_node) {
|
||||||
ERR_FAIL_NULL(p_node);
|
ERR_FAIL_NULL(p_node);
|
||||||
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
CollisionObject *collision_object = Object::cast_to<CollisionObject>(p_node);
|
||||||
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
|
ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two nodes that inherit from CollisionObject (such as Area or PhysicsBody).");
|
||||||
PhysicsServer::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid());
|
PhysicsServer::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user