Skip to content

Refactor physics-2d based on box2d 3.2 (latest commits)#3095

Open
halx99 wants to merge 15 commits intodevfrom
physics-2d
Open

Refactor physics-2d based on box2d 3.2 (latest commits)#3095
halx99 wants to merge 15 commits intodevfrom
physics-2d

Conversation

@halx99
Copy link
Collaborator

@halx99 halx99 commented Mar 20, 2026

Describe your changes

  • Update box2d to latest
  • Refactor Joint2D, re-write Joint2D tests
  • Implement Contact2D PreSolve, PostSolve event
  • Refactor Rigidbody2D managment, now auto managed as component of Node, not add to PhysicsWorld2D
  • Refactor physics2d const variable
  • Collider2D filter bitmask

Issue ticket number and link

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

Axmol 3.x ------------------------------------------------------------

For each 3.x PR

  • Check the '#include "axmol.h"' and replace it with the needed headers.

@halx99 halx99 added this to the 3.0.0 milestone Mar 20, 2026
@halx99 halx99 force-pushed the physics-2d branch 2 times, most recently from 1f449c6 to 4b65fdf Compare March 20, 2026 16:50
@halx99 halx99 linked an issue Mar 21, 2026 that may be closed by this pull request
halx99 added 3 commits March 22, 2026 12:18
- Remove Rigidbody2D::setTag
- Make CollisionFilter works with box2d
- Make change rigidbody2d betweens node works
- Add API: Rigidbody2D::setMass and Rigidbody2D::setAutoMass
- Make rigidbody transform stable when change between nodes
@halx99 halx99 changed the title Refactor physics-2d Refactor physics-2d based on box2d 3.2 (latest commits) Mar 22, 2026
@halx99
Copy link
Collaborator Author

halx99 commented Mar 22, 2026

/clang-format

@axmol-bot
Copy link
Collaborator

👋 @halx99 Command /clang-format received. Running code formatting, please wait...

@axmol-bot
Copy link
Collaborator

✅ Formatting completed and changes have been committed to the PR branch: physics-2d.
@halx99 please refresh to see the latest code.

@halx99
Copy link
Collaborator Author

halx99 commented Mar 23, 2026

/gemini review

@gemini-code-assist

This comment was marked as off-topic.

@halx99 halx99 marked this pull request as ready for review March 23, 2026 16:15
@halx99
Copy link
Collaborator Author

halx99 commented Mar 23, 2026

/gemini review

@gemini-code-assist

This comment was marked as off-topic.

@aismann aismann self-requested a review March 23, 2026 18:57
@aismann
Copy link
Contributor

aismann commented Mar 23, 2026

  • "One Way Platform test" is duplicated (1+9)
  • No/bad interaction (mouse) on
    • 8 Pump
    • 13 Position/Rotation Test
  • 5 Raycast (Change mode (multiple) is not working correct ( i miss a second contact ball)
image

Comparing the Joints its different:
chipmunk
image

Box2d:
image

12 Contact Test:
yellow triangle is leaving the screen. should not

14 Set Gravity
Yellow box dancing (wobbles) on the ground (chipmunk jump only up and down a little bit)

5 Raycast again:
(Change mode (nearest or any) is not implemented (also not on Chipmunk)

"all" if the box fall down and have contact with the ground...the box is wobbles

Maybe an important PR on Box2d (which should be add to this PR?):
image

- Rename API: Rigidbody2D::setRotationEnable -> Rigidbody2D::setRotationEnabled
- Fix gravity units
- Disable commonBox rotation for Test: 'PhysicsSetGravityEnableTest'
@halx99
Copy link
Collaborator Author

halx99 commented Mar 24, 2026

/clang-format

@axmol-bot
Copy link
Collaborator

👋 @halx99 Command /clang-format received. Running code formatting, please wait...

@axmol-bot
Copy link
Collaborator

✅ Formatting completed and changes have been committed to the PR branch: physics-2d.
@halx99 please refresh to see the latest code.

@aismann
Copy link
Contributor

aismann commented Mar 24, 2026

9.Slize
tested with the latest (today) artifact:
the slize "cut" not all created polygons
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reimplement physics2d with box2d

3 participants