Optimized area check
This commit is contained in:
parent
29fd942dd6
commit
b1934cfd0d
|
@ -650,7 +650,6 @@ void SpaceBullet::check_ghost_overlaps() {
|
||||||
/// Algorithm support variables
|
/// Algorithm support variables
|
||||||
btCollisionShape *other_body_shape;
|
btCollisionShape *other_body_shape;
|
||||||
btConvexShape *area_shape;
|
btConvexShape *area_shape;
|
||||||
btGjkPairDetector::ClosestPointInput gjk_input;
|
|
||||||
AreaBullet *area;
|
AreaBullet *area;
|
||||||
int x(-1), i(-1), y(-1), z(-1), indexOverlap(-1);
|
int x(-1), i(-1), y(-1), z(-1), indexOverlap(-1);
|
||||||
|
|
||||||
|
@ -704,10 +703,6 @@ void SpaceBullet::check_ghost_overlaps() {
|
||||||
btTransform area_shape_treansform(area->get_bt_shape_transform(y));
|
btTransform area_shape_treansform(area->get_bt_shape_transform(y));
|
||||||
area_shape_treansform.getOrigin() *= area_scale;
|
area_shape_treansform.getOrigin() *= area_scale;
|
||||||
|
|
||||||
gjk_input.m_transformA =
|
|
||||||
area->get_transform__bullet() *
|
|
||||||
area_shape_treansform;
|
|
||||||
|
|
||||||
area_shape = static_cast<btConvexShape *>(area->get_bt_shape(y));
|
area_shape = static_cast<btConvexShape *>(area->get_bt_shape(y));
|
||||||
|
|
||||||
// For each other object shape
|
// For each other object shape
|
||||||
|
@ -721,29 +716,20 @@ void SpaceBullet::check_ghost_overlaps() {
|
||||||
btTransform other_shape_transform(otherObject->get_bt_shape_transform(z));
|
btTransform other_shape_transform(otherObject->get_bt_shape_transform(z));
|
||||||
other_shape_transform.getOrigin() *= other_body_scale;
|
other_shape_transform.getOrigin() *= other_body_scale;
|
||||||
|
|
||||||
gjk_input.m_transformB =
|
btCollisionObjectWrapper obA(
|
||||||
otherObject->get_transform__bullet() *
|
NULL,
|
||||||
other_shape_transform;
|
|
||||||
|
|
||||||
if (other_body_shape->isConvex()) {
|
|
||||||
|
|
||||||
btPointCollector result;
|
|
||||||
btGjkPairDetector gjk_pair_detector(
|
|
||||||
area_shape,
|
area_shape,
|
||||||
static_cast<btConvexShape *>(other_body_shape),
|
area->get_bt_ghost(),
|
||||||
gjk_simplex_solver,
|
area->get_transform__bullet() * area_shape_treansform,
|
||||||
gjk_epa_pen_solver);
|
-1,
|
||||||
gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
|
y);
|
||||||
|
btCollisionObjectWrapper obB(
|
||||||
if (0 >= result.m_distance) {
|
NULL,
|
||||||
hasOverlap = true;
|
other_body_shape,
|
||||||
goto collision_found;
|
otherObject->get_bt_collision_object(),
|
||||||
}
|
otherObject->get_transform__bullet() * other_shape_transform,
|
||||||
|
-1,
|
||||||
} else {
|
z);
|
||||||
|
|
||||||
btCollisionObjectWrapper obA(NULL, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y);
|
|
||||||
btCollisionObjectWrapper obB(NULL, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z);
|
|
||||||
|
|
||||||
btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
|
btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
|
||||||
|
|
||||||
|
@ -760,7 +746,6 @@ void SpaceBullet::check_ghost_overlaps() {
|
||||||
hasOverlap = true;
|
hasOverlap = true;
|
||||||
goto collision_found;
|
goto collision_found;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} // ~For each other object shape
|
} // ~For each other object shape
|
||||||
} // ~For each area shape
|
} // ~For each area shape
|
||||||
|
|
Loading…
Reference in a new issue