Implement unit tests for Camera3D #67170
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds unit tests for
Camera3D
. Methods tested are:is_position_behind
is_position_in_frustum
project_position
unproject_position
The projection test is currently failing with
Frustum
projection mode. I don't really know how that mode works, to be honest, so any input would be appreciated.A placeholder size variable is also added here to
DisplayServerHeadless
in order to make it possible to project points in headless mode. I'm not sure if this will have any unintended consequences, so I would appreciate feedback from aDisplayServer
expert. If not, it could be helpful for godotengine/godot-proposals#1760.I noticed a fair bit of code duplication between
project_position
,project_ray_origin
, andproject_local_ray_normal
while working on this. I think they can probably be refactored to all forward calls to a single function, but I thought that was better left for another PR.Part of #43440.