I'm a beginner and confused with them. In console, their location have different values. So, what is the meaning of their own?
locationInView will give you the current location of the touch by the user according to normal cartesian co-ordinate system which is in portrait mode.
However, you need to convert those co-ordinates into OpenGL co-ordinates for getting the actual location. convertToGL just converts the co-ordinates into the current layout which maybe landscape mode or any other mode.
While, convertToNodeSpace will be used in, for example, tile-based games, where you have a big map. convertToNodeSpace will convert your openGL touch co-ordinates to the co-ordinates of the .tmx map or anything similar.
For example, consider following figure. you maybe having a map of (1000,2000) size.
Now, when you touch the screen for the first time co-ordinates will be stored in normal portrait mode, which after converting into openGL will give you the correct co-ordinates on screen, say (100,100). But your current location on map is (800,800). To get this location, u need convertToNodeSpace.
Hope this helps. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With