New answers tagged

0

In my experience, Box2D is a little fussy about dealing with things such as line lengths that are shorter than a hard-coded lower limit. I don't recall the lower limits, but you can find the checks in the Box2D source. Box2D will throw an exception which is unable to cross the JNI boundary and brings the whole process down with no explanation. Maybe add some ...


0

you could just move the transform.y up n number of times until the feet are on the ledge and forget the physics temporarily, i think it will work fine, you can always measure the distance between falling objects and the player in case collision fails during a transform translation. to make sure a collision occcurs..


2

Do not use boxes for this kind of terrain. There are numerous problems that arise with using boxes, namely "catching" of objects on the intersections between the boxes. Box2D provides Edge Shape (line) primitives as well as a Chain Shape that far better suites your purpose. From the linked manual: // This a chain shape with isolated vertices b2Vec2 vs[4]; ...


0

You can compute the angle with the arctangent function atan2 (from math.h) float angle = atan2(differenceY, differenceX);


0

I would suggest having a look at this page and using a viewport to manage both cameras. Since you don't want scaling a ScreenViewport would be the way to go. https://github.com/libgdx/libgdx/wiki/Viewports // These would be the cameras you have set up which are following the players Camera playerOneCamera; Camera playerTwoCamera; ScreenViewport ...


0

I recommend you look into how box2D works. Anyways use one of the below, most likely BeginContact. void BeginContact(b2Contact* contact); void EndContact(b2Contact* contact); Excerpt from the from the greatest source of Box2d knowledge know to mankind to explain why. iforce2d.com: Anatomy of a collision Impact 1, 2, 3 When fixtures are ...



Top 50 recent answers are included