Tag Info

Hot answers tagged

2

Yet having these 3500 sleeping static bodies degrades performance to such a degree that even when running the game on my MacBook Pro 2012 in a Genymotion emulator, I get about 5 FPS. As Anko said in his comment, you shouldn't be guessing about whether this is Box2D or rendering or something else. Measure what's taking all the frame time. Use a profiler ...


2

Part 1: Interpolation: Interpolation let's us approximate something that already happened. Multiplying "trick" (which is just math) is to mix the previous state with the current state by a certain percentage. If previous was dark and now is bright, we assume in the middle it was grey. So if for example we take a moving train. We know that right now it is ...


1

Well on your question fixture def, you set sensor true which makes it ignore collisions. fixtureDef.isSensor = true; Unrelated but as a side note, I think you need to dispose your polygonShape at the end after creating everything. polygonShape.dispose()


1

Assuming the rope has no weight, this problem is about finding the lowest point of an ellipse (http://en.wikipedia.org/wiki/Ellipse ) where (PF1+PF2 == rope length) This image show how the ellipse is rotated. From there you can figure out the lowest point by tracing the ellipse with a binary search to find the lowest point. That's where the weight should ...


1

Try sprite.setOriginCenter(); This should help


1

There is no need to update each body when modifying the camera. Bodies' positions stays the same when you move the camera around. batch.setProjectionMatrix(cam.combined); already offsets your batch to the right position. The problem must result of this line : player.body.setTransform(fingerPosition.x, fingerPosition.y, player.body.getAngle()); Assuming ...


1

I have seen two ways of achieving this, one is to let the UserData of the Box2D Body hold the Sprite. body.setUserData(mySprite); And in the update you retrieve that and apply position and rotation to the Sprite according to the Body's transform; Sprite sprite = (Sprite)body.getUserData(); Vector2 position = body.getPosition(); // Center body is center ...


1

You can use the setUserData method to attach an Object to the box2D body (like for example a Sprite or an Actor): body.setUserData(sprite); Accordingly you can get your Sprite back like this: (Sprite) body.getUserData(); Note that you need to cast to Sprite.


1

Correct me if I'm wrong, but I believe the density of fixtures will affect the mass of the body. Anyway, the only settings that affect the "bounciness" is restitution. If changing the restitution of the box doesn't fix it, have you tried changing the restitution of the ground (or whatever the box shouldn't be bouncing off of)? If that doesn't work, as far ...



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