DirX::new
should be more explicit about normalization and have a code example
#13429
Labels
A-Math
Fundamental domain-agnostic mathematical operations
C-Docs
An addition or correction to our documentation
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
X-Uncontroversial
This work is generally agreed upon
How can Bevy's documentation be improved?
The documentation for the
new
constructors of direction types doesn't explicitly state that the given vector gets automatically normalized by the method.For example,
Dir2
:Arguably, the normalization is implied because it "creates a direction", which based on the type's definition should be normalized. Still, I have seen several users do something like this:
resulting in a double normalization.
We should make the comment more explicit about the normalization, and also add a code example in the doc comment to show how the type is intended to be used. This code example could also showcase some error cases, like a zero vector.
The text was updated successfully, but these errors were encountered: