-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Geometry3D.triangle_box_overlap()
to scripting
#11467
Comments
Makes sense, but since you already need to make a wrapper due to the points a b c, maybe the public-facing API could be improved further to use the AABB class instead of boxcenter and boxhalfsize. |
Geometry3D.triangle_box_overlap()
to scripting
I'm not sure it would be a good idea, the point of Geometry3D is to be an helper class that give access to advanced geometry functions using basic data. I think keeping it simple is better, if you want to use AABB you can create a wrapper in your project (which i did for my testing of the function), it's as simple as getting an AABB, getting the center using AABB.get_center(), and getting the halfsize by getting the AABB.size /2. Or just use it in the same way as the engine scripts use it for this exact purpose, like here : Vector3 qsize = aabb.size * 0.5; //quarter size, for fast aabb test
if (!Geometry3D::triangle_box_overlap(aabb.position + qsize, qsize, p_points)) {
//does not fit in child, go on
continue;
} or here : //test against original bounds
if (!Geometry3D::triangle_box_overlap(aabb.get_center(), aabb.size * 0.5, face.vertex)) {
continue;
} |
An AABB variant can just be constructed like Though I do now see the cost of having to compute the center and halfsize, given an AABB. I looked into the algorithm code and it doesn't derive any user friendly values from these which would better serve as inputs. In that case I recommend as a change: rename |
Describe the project you are working on
It's a project that require an extensive use of a triangle-box detection function.
Describe the problem or limitation you are having in your project
Using collider nodes for this would be either extremely inefficient or outright not work at all due to the amount of collider nodes it would require, I tried.
So it took me three days failing to create a functional triangle-box detection function for my project before I decided to check Godot/core to see if there was something similar I could use as a basis, only for me to realize that Geometry3D had the exact function I actually needed all along with no mentions of it's existence and no way to access it.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It's just exposing triangle_box_overlap that already exists in Geometry3D.
It works, I already tested it in a custom Godot build, but I don't want to compile a new custom Godot build every update just because a helper class does not have the wrapper for the one function I need.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add that code to godot/doc/classes/Geometry3D.xml :
Add that code to godot/core/core_bind.cpp :
in Geometry3D
in void Geometry3D::_bind_methods()
And finally add that code to godot/core/core_bind.h :
in class Geometry3D : public Object
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
It is in core, and as a matter of fact i think it's pretty stupid that a helper class has it's functions inconsistently wrapped, and the others functions not wrapped in Geometry3D should also be exposed.
The text was updated successfully, but these errors were encountered: