Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a depth parameter to Camera::project_position() #29248
Camera::project_position()'s current implementation makes assumptions that seem to work against the practical value of a function for converting 2D viewport coordinates into 3D coordinates. The current undocumented behaviour of returning a point on the camera's near clipping plane doesn't align with any use-cases that I can come up with, and is far enough from intuitive that I had to read the code to work out what was going on.
Having the depth exposed as a parameter allows the near clipping plane to be passed in if that ever happens to be desirable, while making the function more broadly usable without having to temporarily change the near clipping plane position.
In case preserving the current behaviour is desirable, I'd be happy to look at that, but I'm not sure how to approach function overloading with the language binding implementation.
This is a strange function that was there since the beginning that served no real purpose (the actual one that is used everywhere is project_ray_position). It also does not match the sister function unproject_position, as it adds a near value that is unwanted.
I think the PR is good, but depth should be 0 by default