Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.