Open Jesusemora opened 3 weeks ago
I don't think removing the error case from these methods is correct, but I also do understand your point and agree to some degree as I've encountered the same issue before. There are times when if it fails I'd rather nothing happens and I don't need nor want to see the error message. I typically run into this case when creating @tool
scripts where sometimes a node is aligned with the up vector just because I haven't had a chance to move them yet.
That said, I think the error message is important to indicate why the method apparently did nothing, especially for newer users.
So if there's any change to make, perhaps its a "fallible" version of these methods, sort of akin to Node.get_node_or_null
where it's explicitly acceptable if the node is not found. Maybe something like try_look_at
or try_look_at_from_position
. where in these error conditions outlined, no error is emitted and nothing happens.
Describe the project you are working on
3D game
Describe the problem or limitation you are having in your project
this is a very common problem with the
look_at
andlook_at_from_position
functionswhen the Vectors are aligned or equal to zero they throw an error. the error shows that the engine is testing for these things.
the current solution is to do something like:
but this means that we are performing the check twice, in gdscript and in the engine, it also adds unnecessary complexity.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
just get rid of the error, we don't need to know that it failed and doing the check twice is redundant. this would greatly simplify things.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I believe this is the code:
we could instead do a simple check
If this enhancement will not be used often, can it be worked around with a few lines of script?
yes, but this is to reduce redundancy and improve usability.
Is there a reason why this should be core and not an add-on in the asset library?
because it seems relatively easy