Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ParallaxCamera extends OrthographicCamera
- {
- Matrix4 parallaxView = new Matrix4 ();
- Matrix4 parallaxCombined = new Matrix4 ();
- Vector3 tmp = new Vector3 ();
- Vector3 tmp_2 = new Vector3 ();
- public ParallaxCamera (float viewportWidth, float viewportHeight) { super (viewportWidth, viewportHeight); }
- public Matrix4 calculateMatrix (float x, float y)
- {
- update ();
- tmp.set (position);
- tmp.x *= x;
- tmp.y *= y;
- parallaxView.setToLookAt (tmp, tmp_2.set (tmp).add (direction), up);
- parallaxCombined.set (projection);
- Matrix4.mul (parallaxCombined.val, parallaxView.val);
- return parallaxCombined;
- }
- }
- clickPos.set (Gdx.input.getX (), Gdx.input.getY (), 0);
- camera.unproject (clickPos);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement