-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix Camera3D project_*
methods not accounting for frustum offset
#75806
Conversation
Edit: |
So to fix I would like to give
This relates to issue #41872 solving that issue in a different manner. The documentation of the ray-tracing tutorial would also need to be updated. |
project_*
methods not accounting for frustum offset
Could you please squash your commits into one? Make sure that the final commit has a short but descriptive message (the title of this PR is a good option). See this documentation, if you need help with squashing. |
I've squashed the commits. It fixes the issues with the I'm currently not working on a fix for |
There seems to be two issues remaining:
|
6a7dd6b
to
3d01c3e
Compare
I've added a condition check to ensure that the Camera3D is part of the scene tree. I've moved the documentation entry in the XML file and added information about it requiring to be part of the scene tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this PR locally (rebased against The red cross denotes my click position, similar to the MRP. The MRP uses
The logic of the PR itself makes sense to me, and exposing |
So our recommendation for the author of the issue would be to implement it differently after the fix is merged? |
This does not fix Camera3D::project_ray_normal(). Adds Camera3D::get_camera_projection() and exposes it to GDScript
Taking a look at the code and running locally. The code changes seem fine and appear to be an improvement, however, the problem identified in #61174 remains and the MRP is not fixed. So there must be an additional change needed somewhere to make this complete. |
@clayjohn I think this is what Calinou points to? |
yep |
The MRP relies on The projection matrix being exposed does allow a workaround to be written in GDScript though. |
Thanks for the clarification. That makes sense. I was a bit confused because What sort of issues were you running into? Maybe we can help you get unit tests working so you can take the next step in fixing the MRP. If you aren't interested in taking this further, that is also understandable. I think we can go ahead and merge as is without closing the original bug report. |
Thanks! |
Cherry-picked for 4.1.1. |
I extracted the duplicated code into a new function
Camera3D::_get_camera_projection(p_near)
and then added support for thePROJECTION_FRUSTUM
mode. This partially addresses #61174.Additionally I added
Camera3D::get_camera_projection()
which returns the Camera's projection matrix,but is currently unused. I think it is useful to expose that method to GDScript as well (currently there's no practical way to get the camera's projection matrix). How would I do that? Should this method be virtual (just likeand added GDScript bindings.get_camera_transform()
)?I still have to add unit tests, probably merge some of the commits and improve the commit messages. Is there anything else that I need to do for this PR to be accepted?