Advertisement
dermetfan

answer on deleted comment about Box2D camera resizing

Oct 23rd, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. http://www.youtube.com/watch?v=dF5dUiJtYng&lc=ho4m9VeFjkmwbELgFTVA_xDJMZ7JUu2IyYwHbl__KtQ&lch=email_reply&feature=em-comment_reply_received
  2.  
  3. Just put this in the resize method, it should do all that's necessary:
  4. camera.viewportWidth = width / unitScale;
  5. camera.viewportHeight = height / unitScale;
  6. camera.update();
  7. That's actually what's in the code of this tutorial as well, check out the source in the description.
  8.  
  9. If you set the projection matrix of the SpriteBatch to the combined one of the camera (like you usually do every frame), it should work without problems:
  10. batch.setProjectionMatrix(camera.combined);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement