Skip to content

2D Physics Engines Information

Dani Alias edited this page Jan 12, 2025 · 5 revisions

Available 2D Physics Engines

  • Chipmunk2D

    • Use the class PhysicsSpriteChipmunk2D
    • Check cpp-test: Chipmunk2D - Basic
  • Box2D

    • Use the class PhysicsSpriteBox2D
    • Check cpp-test: Box2D - Basic
  • Axmol 2D physics integration API

    • Axmol is using Chipmunk2D as the internal 2D physics engine by default.
    • Check cpp-test: Node: Physics
    • 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. See also Issue #1573.

  • Outdated / Abandoned / Cocos2d-x:
    • Class PhysicsSprite: It's only part of Axmol for backwards compatibility with Cocos2d-x. Use AX_ENABLE_BOX2D_INTEGRATION 1 (when using Box2D) or AX_ENABLE_CHIPMUNK_INTEGRATION 1 (when 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).