How can I take screen coordinates (or alternatively world coordinates on the 'primary' parallax plane) and find out what world coordinates they translate into when taking parallax depth into account?
I want to be able to tell if a rectangle is under the mouse cursor. I'm using libGDX and the
ParallaxCamera class from the tests module. This means depth is modelled in two dimensions, where 1 == primary plane, 0 == pinned to the screen, 0,5 == scrolls at half the rate of the primary plane.
This is trivial in the primary parallax plane, as libGDX's camera has a handy
unproject method. However, I can't find any examples that use the 'parallax matrix', as this is typically passed into a
SpriteBatch#setProjectionMatrix rather than being used in internal camera calculations.
I don't understand the mathematics enough to figure this out. If anyone reading this can link to any very basic explanations of the mathematics behind projecting things with parallax depth into screen space and vice versa, I'd be really grateful to read it.