Skip to content

2D Physics Engines Information

aismann edited this page May 22, 2024 · 3 revisions

Available 2D Physics Engines

(Check cpp-tests in WebAssembly here)

  • Chipmunk2D engine (Cpp-Tests: Chipmunk2D - Basic)

    • Use class PhysicsSpriteChipmunk2D
  • Box2D engine (Cpp-Tests: Box2D - Basic)

    • Use class PhysicsSpriteBox2D
  • Axmol 2D physics integration API (Cpp-Tests: Node: Physics)

    • It using Chipmunk2D as internal 2D physics engine
    • Tricks 'n' Tips
      • Problems with setContentSize() see also Issue #1573

        NOTE: The content size of a sprite cannot be changed after the physics object is set on a node. This means you should not call setContentSize() with a different size (directly or indirectly) after you have set the physics body on the node. You can scale the node (via setScale), rotate it, etc., just do not change the content size once a physics body is attached. For animating sprites, this also means sprite frames in an animation must all be the same size.

  • Outdated / Abandoned / Cocos2d-x:

    • Class PhysicsSprite: Be only part of the axmol for backwards compatibility with Cocos2d-x. Use AX_ENABLE_BOX2D_INTEGRATION 1 (using Box2D) or AX_ENABLE_CHIPMUNK_INTEGRATION 1 (using Chipmunk2D)

Chipmunk2D - Box2D - Testbeds:

The goals were:

  • Using the original source files of the testbeds as possible.
  • Let the original source files be the original sources as much as possible.
  • Give "a small view" to the Testbed examples.
  • Please remind: Not all 'Box2D - TestBed' demos working full at the moment (because of different keyboard implementation, mouse buttons has some lags also).