diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-11 12:38:08 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-11 12:38:08 +0200 |
commit | 816f6170fa8dacc3876ed93db6ca3596341b6fb1 (patch) | |
tree | 02d04c02939c0e23523632ec3f817b22a39b1551 /core/math/aabb.h | |
parent | 0ffa6e2039d60d51ebe8cfdda9423e15d6dce1f3 (diff) | |
parent | b35264ad95193349c51a9277abe571b711282cfb (diff) | |
download | redot-engine-816f6170fa8dacc3876ed93db6ca3596341b6fb1.tar.gz |
Merge pull request #86755 from lawnjelly/aabb_intersect_fix
Fix AABB Ray intersection - return inside
Diffstat (limited to 'core/math/aabb.h')
-rw-r--r-- | core/math/aabb.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/math/aabb.h b/core/math/aabb.h index c2945a3ef1..9a74266ff7 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -71,10 +71,15 @@ struct _NO_DISCARD_ AABB { AABB merge(const AABB &p_with) const; void merge_with(const AABB &p_aabb); ///merge with another AABB AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs - bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const; - bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const; _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t p_t0, real_t p_t1) const; + bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_intersection_point = nullptr, Vector3 *r_normal = nullptr) const; + bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir) const { + bool inside; + return find_intersects_ray(p_from, p_dir, inside); + } + bool find_intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, bool &r_inside, Vector3 *r_intersection_point = nullptr, Vector3 *r_normal = nullptr) const; + _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const; _FORCE_INLINE_ bool inside_convex_shape(const Plane *p_planes, int p_plane_count) const; bool intersects_plane(const Plane &p_plane) const; |