|
@@ -32,12 +32,10 @@
|
|
|
|
|
|
bool AreaPairSW::setup(float p_step) {
|
|
bool AreaPairSW::setup(float p_step) {
|
|
|
|
|
|
- if (!area->test_collision_mask(body)) {
|
|
|
|
- colliding = false;
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- bool result = CollisionSolverSW::solve_static(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), NULL, this);
|
|
|
|
|
|
+ bool result =
|
|
|
|
+ area_shape != -1 && body_shape != -1 &&
|
|
|
|
+ area->test_collision_mask(body) &&
|
|
|
|
+ CollisionSolverSW::solve_static(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), NULL, this);
|
|
|
|
|
|
if (result != colliding) {
|
|
if (result != colliding) {
|
|
|
|
|
|
@@ -65,6 +63,21 @@ bool AreaPairSW::setup(float p_step) {
|
|
void AreaPairSW::solve(float p_step) {
|
|
void AreaPairSW::solve(float p_step) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void AreaPairSW::shift_shape_indices(const CollisionObjectSW *p_object, int p_removed_index) {
|
|
|
|
+
|
|
|
|
+ if (p_object == body) {
|
|
|
|
+ if (body_shape == p_removed_index)
|
|
|
|
+ body_shape = -1;
|
|
|
|
+ else if (body_shape > p_removed_index)
|
|
|
|
+ body_shape--;
|
|
|
|
+ } else if (p_object == area) {
|
|
|
|
+ if (area_shape == p_removed_index)
|
|
|
|
+ area_shape = -1;
|
|
|
|
+ else if (area_shape > p_removed_index)
|
|
|
|
+ area_shape--;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
AreaPairSW::AreaPairSW(BodySW *p_body, int p_body_shape, AreaSW *p_area, int p_area_shape) {
|
|
AreaPairSW::AreaPairSW(BodySW *p_body, int p_body_shape, AreaSW *p_area, int p_area_shape) {
|
|
|
|
|
|
body = p_body;
|
|
body = p_body;
|
|
@@ -95,13 +108,10 @@ AreaPairSW::~AreaPairSW() {
|
|
|
|
|
|
bool Area2PairSW::setup(float p_step) {
|
|
bool Area2PairSW::setup(float p_step) {
|
|
|
|
|
|
- if (!area_a->test_collision_mask(area_b)) {
|
|
|
|
- colliding = false;
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // bool result = area_a->test_collision_mask(area_b) && CollisionSolverSW::solve(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),Vector2(),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),Vector2(),NULL,this);
|
|
|
|
- bool result = CollisionSolverSW::solve_static(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), NULL, this);
|
|
|
|
|
|
+ bool result =
|
|
|
|
+ shape_a != -1 && shape_b != -1 &&
|
|
|
|
+ area_a->test_collision_mask(area_b) &&
|
|
|
|
+ CollisionSolverSW::solve_static(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), NULL, this);
|
|
|
|
|
|
if (result != colliding) {
|
|
if (result != colliding) {
|
|
|
|
|
|
@@ -131,6 +141,21 @@ bool Area2PairSW::setup(float p_step) {
|
|
void Area2PairSW::solve(float p_step) {
|
|
void Area2PairSW::solve(float p_step) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void Area2PairSW::shift_shape_indices(const CollisionObjectSW *p_object, int p_removed_index) {
|
|
|
|
+
|
|
|
|
+ if (p_object == area_a) {
|
|
|
|
+ if (shape_a == p_removed_index)
|
|
|
|
+ shape_a = -1;
|
|
|
|
+ else if (shape_a > p_removed_index)
|
|
|
|
+ shape_a--;
|
|
|
|
+ } else if (p_object == area_b) {
|
|
|
|
+ if (shape_b == p_removed_index)
|
|
|
|
+ shape_b = -1;
|
|
|
|
+ else if (shape_b > p_removed_index)
|
|
|
|
+ shape_b--;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
Area2PairSW::Area2PairSW(AreaSW *p_area_a, int p_shape_a, AreaSW *p_area_b, int p_shape_b) {
|
|
Area2PairSW::Area2PairSW(AreaSW *p_area_a, int p_shape_a, AreaSW *p_area_b, int p_shape_b) {
|
|
|
|
|
|
area_a = p_area_a;
|
|
area_a = p_area_a;
|