Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Bullet physics debug drawing #2895

Merged
merged 1 commit into from Jun 21, 2023

Conversation

MoritzBrueckner
Copy link
Collaborator

This PR adds debug drawing support for Bullet physics. It requires armory3d/haxebullet#42 where I explained some more technical details.

Collider Wireframes

Contact Points

Ragdoll Constraints

The debug drawing settings can be found in the Rigid Body World panel of the scene properties:

grafik

On the Haxe side there are more debug flags available, however, these do not take effect in Armory since Bullet does not use them in the library core, instead they seem to be used in individual (and sometimes obsolete) Bullet examples only (urgh...). Some flags have dependencies between each other, the wireframe flag even leads to drawing the suspension of raycast vehicles for whatever reason (Bullet's codebase truly is something else... :D). In some cases I have put some explanations for the unused flags as comments to the code.

Tested on krom, html5 and windows-hl.

Potential future work

  • Implement proper clipping for drawing lines. Currently lines aren't rendered if any end is out of the far/near camera range.
  • Investigate whether we can implement debug drawing for Oimo physics, if we still plan to support it. @luboslenco What was the reason for adding it in the first place? Does it have some features that Bullet hasn't?
  • We could merge the line drawing with the debug console's line drawing, but then we need to decide whether we want to use the same kind of line drawing (2D vs. 3D) for both.
  • Perhaps improve the drawing of the contact points, there are probably better ways to vizualize these than using diagonal crosses (+ normal vector).
  • Expose the debug drawing flags in the debug console
  • If someone knows a way to better align the checkboxes in the Blender UI and still have a good-looking margin to one of the panel sides (which does not exist if layout.use_property_split == False), please let me know :)

Thanks to all involved on the Discord server with providing feedback and ideas!

@luboslenco luboslenco merged commit d727038 into armory3d:main Jun 21, 2023
@luboslenco
Copy link
Member

What was the reason for adding it in the first place?

I think it was not about features but due to being written in Haxe and being more lightweight.

@tong
Copy link
Contributor

tong commented Jun 21, 2023

Awesome!

@MoritzBrueckner MoritzBrueckner deleted the bullet-debug-drawing branch June 21, 2023 16:15
@MoritzBrueckner MoritzBrueckner added the Release Notes: Changes A pull request that is a feature change, not a fix. Used to generate release notes. label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Notes: Changes A pull request that is a feature change, not a fix. Used to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants