Giter Club home page Giter Club logo

Comments (3)

badlogic avatar badlogic commented on May 2, 2024

From badlogicgames on July 21, 2010 18:14:45

Hi,

JBox2D is implemented against version 2.0.1 of Box2D. Libgdx is using version 2.1.2 which has some major API changes, especially in the area of Fixtures and Shapes. Please refer to the original Box2D sources and examples. I had a look at the testbed of Box2D and how rendering of bodies/fixtures/joints is performed. Please see the File b2World.cpp, method b2World::DrawDebugData() which in turn renders all the different parts of the simulation. Sorry for the inconvenience, i should have made it more clear against which version libgdx is build.

This is not a defect.

Status: Invalid

from libgdx.

badlogic avatar badlogic commented on May 2, 2024

From badlogicgames on July 21, 2010 18:28:01

Whoops, i spoke to soon. While my claim above still stands (JBox2D != libgdx Box2D version), the libgdx port is missing one important feature: b2Body->GetTransform() is not implemented. This is a 2x2 matrix encoding the rotation as well as the world position of the body. If you loop over the fixtures you'd normally get the shape of the fixture and transform it's points (center for CircleShape, vertices of PolygonShape). These shape points are exposed in the respective classes, the transform of the body is not. See b2World::drawShape for an example of how to draw fixtures given the transform of their body.

Now, you can actually do something else, namely using the bodys world position and the rotation angle and implement the transform multiply yourself. That's around 3 lines of code. It's 3:26am here so i refrain from writting it from the top of my head. Rest assured that i will implement a full renderer this weekend along with the testbed of box2d 2.1.2 examples so i can finally iron out those last few bugs in the wrapper.

Status: Accepted
Labels: -Type-Defect Type-Enhancement

from libgdx.

badlogic avatar badlogic commented on May 2, 2024

From badlogicgames on July 25, 2010 02:55:45

Fixed and in SVN, see Box2DDebugRenderer for usage examples.

Status: Fixed

from libgdx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.