Tag Info

Hot answers tagged

2

The skewing is because of how the viewport is setup, try changing it to something like this; @Override public void create() { ... bodyDef.position.set(0, 0); // Let this be at origin for now, it's easier to debug ... camera = new OrthographicCamera(200, 200 * ((float)Gdx.graphics.getHeight()/(float)Gdx.graphics.getWidth()); ...


2

Directly editing the position of a box2d body will produce non-physical behaviour, it's present because sometimes you will need to teleport bodies to a far away location, or reset the position of an object without the need to destroy/re-create it, etc... In your case the joints are not handling the position adjustments well. The setPosition function should ...


1

You're right, it can be done in two ways: -Moving the player -Moving the world This seems like a 50-50 deal. It doesn't matter how you do it, right? I don't agree. I would ALWAYS suggest moving the player. Because if you choose to move the world now, and a few months further on in development, when you have enemies, npc's, and other entities on screen, ...


1

I know this is an old question, but I've just come across this solution and found that making sure restitution is not above 1 is not enough. friction also caused differentiation in the angle of which it bounces off. so setting friction to 0 allowed me to bounce a ball up against a 45* wall and get the expected perpendicular reaction.


1

What's Happening This is completely accurate physical behaviour, which can be explained using a free-body diagram and a little high school physics1: The mass of the block is m and g is the gravitational constant. Fa is the applied force. To understand why the block is not moving, we can write out the force balances in the x and y directions. x-Momentum ...



Only top voted, non community-wiki answers of a minimum length are eligible