Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCamera related documentation needs improvement regarding touch/screenspace #5853
Comments
|
If you think there is a problem with Camera, your test should only involve camera, and not Stage/Viewports. That said, this is a problem with documentation and variable names. It should really be touchToStageCoordinates, not screenToStageCoordaintes, since its expected touch space input. There are some other inconsistencies that probably should be cleaned up that are the same. |
|
Ok, modified.
|
|
#5854 is the same same issue, and as I said its a problem with documentation as they arent all screen space coordinates. We do not need two issues to discuss this same problem. |
|
Here is a demo that demonstrates that this is a documentation issue. https://gist.github.com/Tom-Ski/3c71425e6a199ec2677fbac39e457e54 |
|
Why are your touch coordinates offset by 1? |
|
Regardless, should a sequence of project and unproject return a different value?
|
|
As an example, if you have a screen of 10x10, bottom left coordinate is 0,0. In touch space, this coordinate is 0,9. Gdx.graphics.getHeight() would return 10 however, we need the offset because we start at 0, not at 1. Range of touch/screen is from (0 to width-1) since we start at 0. |
|
As per the documentation, yes they should. There are just a few inconsistencies with the language used that makes it confusing. Although the documentation (for Camera at least) does describe the difference in coordinate spaces the functions return and expect, it still calls them both screen space, which is the confusing part. The solution here is to improve the docs. |
|
Ok. |
|
OpenGL for reference, specifically gluProject and gluUnProject, compiled and run on Arch Linux/Mesa 3D.
The window size is 300x300, and (0,0) is the point at the centre of the screen.
|
|
My problem iPhone X can’t get it to open I’ve tried everything,boot up tried everything |
|
@mark6412 Don't ask for help on an issue tracker. See: https://github.com/libgdx/libgdx/wiki/Getting-help Seems a bit unfortunate to need to think about touch space coordinates. Ideally we'd have only screen space and world space. |
Issue details
Camera.unproject does not return original value
Reproduction steps/code
Due to the following line in Camera (-1 at the end):
libgdx/gdx/src/com/badlogic/gdx/graphics/Camera.java
Line 197 in c0c1f51
Intended?
Version of LibGDX and/or relevant dependencies
1.9.10