diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-08-03 22:37:30 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-08-03 22:37:30 +0200 |
commit | a56e960150718374533d0a8378fb10db2219ddef (patch) | |
tree | 63764f2dab0732bdf63513ae1443c75d5e5ee495 /core/core_bind.cpp | |
parent | f9f50416758eff6c0b8981af5b4a968fa2e59b8e (diff) | |
parent | af7f787c6ed3ac39f61ca0e346256a5aa6a00289 (diff) | |
download | redot-engine-a56e960150718374533d0a8378fb10db2219ddef.tar.gz |
Merge pull request #71233 from PrecisionRender/barycentric-coords
Add ability to get face index and barycentric coordinates from raycast
Diffstat (limited to 'core/core_bind.cpp')
-rw-r--r-- | core/core_bind.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index a73b198be2..4e220d0839 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -961,6 +961,11 @@ Vector3 Geometry3D::get_closest_point_to_segment_uncapped(const Vector3 &p_point return ::Geometry3D::get_closest_point_to_segment_uncapped(p_point, s); } +Vector3 Geometry3D::get_triangle_barycentric_coords(const Vector3 &p_point, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2) { + Vector3 res = ::Geometry3D::triangle_get_barycentric_coords(p_v0, p_v1, p_v2, p_point); + return res; +} + Variant Geometry3D::ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2) { Vector3 res; if (::Geometry3D::ray_intersects_triangle(p_from, p_dir, p_v0, p_v1, p_v2, &res)) { @@ -1034,6 +1039,8 @@ void Geometry3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_closest_point_to_segment_uncapped", "point", "s1", "s2"), &Geometry3D::get_closest_point_to_segment_uncapped); + ClassDB::bind_method(D_METHOD("get_triangle_barycentric_coords", "point", "a", "b", "c"), &Geometry3D::get_triangle_barycentric_coords); + ClassDB::bind_method(D_METHOD("ray_intersects_triangle", "from", "dir", "a", "b", "c"), &Geometry3D::ray_intersects_triangle); ClassDB::bind_method(D_METHOD("segment_intersects_triangle", "from", "to", "a", "b", "c"), &Geometry3D::segment_intersects_triangle); ClassDB::bind_method(D_METHOD("segment_intersects_sphere", "from", "to", "sphere_position", "sphere_radius"), &Geometry3D::segment_intersects_sphere); |