-
Notifications
You must be signed in to change notification settings - Fork 179
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
KX_Camera.getScreenRay not working if cam is Ortographic #765
Comments
there'is a "mouse" brick in logic editor that trigger "mouseover" and "mouseoverany" event of the object you select |
The idea to solve this issue is to forget about getScreenVect in getScreenRay and instead un-project two points to compute the ray direction and use the first for the ray origin. Is this solution acceptable ? |
@RomStef the problem is when you're not using logic bricks. @panzergame Yes. But from the point of view of the user, the best option is to automatically decided what solver to use (one for the perspective camera and other for the ortographic) inside the getScreenRay (or inside the getScreenVect). By doing this, the user (that in most case will not know the math behind the scenes) will not have to care about this and will be able to use these functions no matter if the camera is ortho or persp. |
@UnidayStudio : The two points solution is general to any kind of cameras and could be optimized in case of perspective camera by using the camera origin as first point to get the ray direction. Concerning getScreenVect, the documentation is: |
@panzergame ok! :) |
Previously the function getScreenRay was adapted to only perspective cameras because the ray cast was always starting from the center of the camera. In case of orthographic the ray cast should start from a point unprojected from the near plane and continue to in the direction of the camera (-Z orientation axis). This is proceeded in getScreenRay and the indirect call to getScreenVect is removed. Fix issue #765.
Previously the function getScreenRay was adapted to only perspective cameras because the ray cast was always starting from the center of the camera. In case of orthographic the ray cast should start from a point unprojected from the near plane and continue to in the direction of the camera (-Z orientation axis). This is proceeded in getScreenRay and the indirect call to getScreenVect is removed. Fix issue #765.
Previously the function getScreenRay was adapted to only perspective cameras because the ray cast was always starting from the center of the camera. In case of orthographic the ray cast should start from a point unprojected from the near plane and continue to in the direction of the camera (-Z orientation axis). This is proceeded in getScreenRay and the indirect call to getScreenVect is removed. Fix issue #765.
Fixed in #781. |
It was fixing #765 Still needs to be tested with getScreenRay files
…1551 from UPBGE/recover_765) It was fixing #765 There was an issue with property not taken into account. I tested with this file: [getScreenRay.zip](https://github.com/UPBGE/upbge/files/7147430/getScreenRay.zip) and it sounds ok then I merge
This function:
https://pythonapi.upbge.org/bge.types.KX_Camera.html#bge.types.KX_Camera.getScreenRay
Doesn't work if the camera are Ortographic. I made a small example:
http://pasteall.org/blend/index.php?id=50026
Press P and nothing will happen. But if you change the camera mode to Perspective and then press P, if you mouse over the cube it will start rotating (what I programmed to do).
This function is very important right now, since we will not have logic bricks to get the mouse over object and things like this.
Thanks! 😄
The text was updated successfully, but these errors were encountered: