Tag Info

New answers tagged


a box2d rectangle has x and y coordinates with thw center in the center of rectangle... other this, to create a rectangle pay attention to give him halfWidth and halfHeight and not full. for example, if you want a 2*2 rectangle in left down corner you have to build it with: x = x+halfWidth y = y+halfHeight halfHeight =1 halfWidth =1


Don't pass delta to getKeyFrame, getKeyFrame takes the state time. The state time is likely something like the sum of all the deltas you've seen so far. The state time indicates how "far" into the animation you've gone, and by constantly passing delta (which if you're running at 60 fps will be 0.016s) the Animation will always yield the first frame.


From what you are saying, it seems like you could also have to simply move the code that resets the angular velocity after a certain angle is reached. I suspect that this code is only used when the button is pressed, since you say pressing the button a second time makes the movement stop (and thus makes the testing code work). If this is the case, you ...


If the middle one works physically and the only problem is the mapping of the texture onto the deform points (and since the deform points don't account for the outer edge of the soft body), wouldn't it be possible to map the texture to points that are offset from the deform point by some value? Try locking rotation of the deform points, you can do that by ...


I think that there is no problem with your code. It's Box2D's thing, that it creates a little bit of skin around the polygons. According to the Box2D manual, a little gap between polygons is being intentionally created to make continuous collision resolution more stable by preventing tunneling, eg. in stacking scenarios. Manual also says one can make their ...


It seems like Box2D is not creating a new instance of Contact everytime, but instead it is changing the most recent contact object's variables. So when you reference the contact object, you get the "updated" one (same object, but with updated variables). You could simply save whatever information you need from the contact object to an object of your own ...


I just stumbled upon the answer: I checked my ScreenViewport and seemingly the viewport somehow ignores the setToOrtho(false, width, height) and the method setUnitsPerPixel(unitScale) has to becalled first... I never saw an example in which a viewport was used together with box2d, tilemap and unitScale, so I didn't even know about that method. The ...

Top 50 recent answers are included