mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
fix max_dist bug with CollisionBox
This commit is contained in:
parent
5430833ef4
commit
6335c11050
@ -383,6 +383,8 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
|||||||
edge_dist = dist_to_polygon(p, _points[ip]);
|
edge_dist = dist_to_polygon(p, _points[ip]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
max_dist = from_radius;
|
||||||
|
|
||||||
// Now we have edge_dist, which is the distance from the sphere
|
// Now we have edge_dist, which is the distance from the sphere
|
||||||
// center to the nearest edge of the polygon, within the polygon's
|
// center to the nearest edge of the polygon, within the polygon's
|
||||||
// plane. edge_dist<0 means the point is within the polygon.
|
// plane. edge_dist<0 means the point is within the polygon.
|
||||||
@ -403,7 +405,6 @@ test_intersection_from_sphere(const CollisionEntry &entry) const {
|
|||||||
// remain from the plane, based on its distance from the nearest
|
// remain from the plane, based on its distance from the nearest
|
||||||
// edge.
|
// edge.
|
||||||
|
|
||||||
max_dist = from_radius;
|
|
||||||
if (edge_dist >= 0.0f) {
|
if (edge_dist >= 0.0f) {
|
||||||
float max_dist_2 = max(from_radius_2 - edge_dist * edge_dist, 0.0f);
|
float max_dist_2 = max(from_radius_2 - edge_dist * edge_dist, 0.0f);
|
||||||
max_dist = csqrt(max_dist_2);
|
max_dist = csqrt(max_dist_2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user