diff options
author | mennomax <mennomax@outlook.de> | 2021-04-08 16:26:14 +0200 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-10-15 20:49:42 -0500 |
commit | b4eeeb315a74682d299c7ec1555ce06a9dc2641a (patch) | |
tree | 4efb789ff3d5673c38dc439eb91127870183f392 /servers/physics_3d | |
parent | 96410f55b24e47af045e3ad31545331ce124d999 (diff) |
Swap args of Plane(point, normal) constructor
Now (normal, point)
Diffstat (limited to 'servers/physics_3d')
-rw-r--r-- | servers/physics_3d/collision_solver_3d_sat.cpp | 14 | ||||
-rw-r--r-- | servers/physics_3d/collision_solver_3d_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics_3d/shape_3d_sw.cpp | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp index 76738bb746..86150f41a0 100644 --- a/servers/physics_3d/collision_solver_3d_sat.cpp +++ b/servers/physics_3d/collision_solver_3d_sat.cpp @@ -183,7 +183,7 @@ static void _generate_contacts_edge_circle(const Vector3 *p_points_A, int p_poin real_t circle_B_radius = circle_B_line_1.length(); Vector3 circle_B_normal = circle_B_line_1.cross(circle_B_line_2).normalized(); - Plane circle_plane(circle_B_pos, circle_B_normal); + Plane circle_plane(circle_B_normal, circle_B_pos); static const int max_clip = 2; Vector3 contact_points[max_clip]; @@ -299,7 +299,7 @@ static void _generate_contacts_face_face(const Vector3 *p_points_A, int p_point_ Vector3 clip_normal = (edge0_B - edge1_B).cross(plane_B.normal).normalized(); // make a clip plane - Plane clip(edge0_B, clip_normal); + Plane clip(clip_normal, edge0_B); // avoid double clip if A is edge int dst_idx = 0; bool edge = clipbuf_len == 2; @@ -385,7 +385,7 @@ static void _generate_contacts_face_circle(const Vector3 *p_points_A, int p_poin // Clip face with circle plane. Vector3 circle_B_normal = circle_B_line_1.cross(circle_B_line_2).normalized(); - Plane circle_plane(circle_B_pos, circle_B_normal); + Plane circle_plane(circle_B_normal, circle_B_pos); static const int max_clip = 32; Vector3 contact_points[max_clip]; @@ -522,7 +522,7 @@ static void _generate_contacts_circle_circle(const Vector3 *p_points_A, int p_po } } - Plane circle_B_plane(circle_B_pos, circle_B_normal); + Plane circle_B_plane(circle_B_normal, circle_B_pos); // Generate contact points. for (int i = 0; i < num_points; i++) { @@ -1194,7 +1194,7 @@ static void _collision_box_capsule(const Shape3DSW *p_a, const Transform3D &p_tr } //Vector3 axis = (point - cyl_axis * cyl_axis.dot(point)).normalized(); - Vector3 axis = Plane(cyl_axis, 0).project(point).normalized(); + Vector3 axis = Plane(cyl_axis).project(point).normalized(); if (!separator.test_axis(axis)) { return; @@ -1303,7 +1303,7 @@ static void _collision_box_cylinder(const Shape3DSW *p_a, const Transform3D &p_t // Points of A, cylinder lateral surface. for (int i = 0; i < 8; i++) { const Vector3 &point = vertices_A[i]; - Vector3 axis = Plane(cyl_axis, 0).project(point).normalized(); + Vector3 axis = Plane(cyl_axis).project(point).normalized(); if (!separator.test_axis(axis)) { return; @@ -1985,7 +1985,7 @@ static void _collision_cylinder_face(const Shape3DSW *p_a, const Transform3D &p_ // Points of B, cylinder lateral surface. for (int i = 0; i < 3; i++) { const Vector3 &point = vertex[i]; - Vector3 axis = Plane(cyl_axis, 0).project(point).normalized(); + Vector3 axis = Plane(cyl_axis).project(point).normalized(); if (axis.dot(normal) < 0.0) { axis *= -1.0; } diff --git a/servers/physics_3d/collision_solver_3d_sw.cpp b/servers/physics_3d/collision_solver_3d_sw.cpp index dcc363638e..96f1936668 100644 --- a/servers/physics_3d/collision_solver_3d_sw.cpp +++ b/servers/physics_3d/collision_solver_3d_sw.cpp @@ -547,7 +547,7 @@ bool CollisionSolver3DSW::solve_distance(const Shape3DSW *p_shape_A, const Trans real_t smin, smax; if (use_cc_hint) { - cc_hint_aabb.project_range_in_plane(Plane(axis, 0), smin, smax); + cc_hint_aabb.project_range_in_plane(Plane(axis), smin, smax); } else { p_shape_A->project_range(axis, rel_transform, smin, smax); } diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp index 0fb6d582c8..789fc6ab33 100644 --- a/servers/physics_3d/shape_3d_sw.cpp +++ b/servers/physics_3d/shape_3d_sw.cpp @@ -777,7 +777,7 @@ Vector3 CylinderShape3DSW::get_closest_point_to(const Vector3 &p_point) const { // Project point to top disk. real_t dir = p_point.y > 0.0 ? 1.0 : -1.0; Vector3 circle_pos(0.0, dir * height * 0.5, 0.0); - Plane circle_plane(circle_pos, Vector3(0.0, dir, 0.0)); + Plane circle_plane(Vector3(0.0, dir, 0.0), circle_pos); Vector3 proj_point = circle_plane.project(p_point); // Clip position. @@ -1025,7 +1025,7 @@ Vector3 ConvexPolygonShape3DSW::get_closest_point_to(const Vector3 &p_point) con Vector3 a = vertices[indices[j]]; Vector3 b = vertices[indices[(j + 1) % ic]]; Vector3 n = (a - b).cross(faces[i].plane.normal).normalized(); - if (Plane(a, n).is_point_over(p_point)) { + if (Plane(n, a).is_point_over(p_point)) { is_inside = false; break; } @@ -1641,7 +1641,7 @@ int HeightMapShape3DSW::get_depth() const { void HeightMapShape3DSW::project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const { //not very useful, but not very used either - p_transform.xform(get_aabb()).project_range_in_plane(Plane(p_normal, 0), r_min, r_max); + p_transform.xform(get_aabb()).project_range_in_plane(Plane(p_normal), r_min, r_max); } Vector3 HeightMapShape3DSW::get_support(const Vector3 &p_normal) const { |