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 debug drawing #42

Merged
merged 2 commits into from Jun 20, 2023

Conversation

MoritzBrueckner
Copy link
Contributor

This PR adds support to use Bullet's debug drawing interface from Haxe.

JS implementation

  • To make strings work in JS, I had to update ammo.js to get access to the Ammo.UTF8ToString() function. This should not break anything hopefully.

HL implementation

  • Since neither Haxe/HL, webidl nor the newer https://github.com/onehundredfeet/hl-idl seem to support implementing C++ interfaces on the Haxe side, I implemented the btIDebugDraw interface in C++.
  • Contrary to JS where we can instantiate multiple DebugDrawer instances, the C++ side uses a singular global debug drawer instance to avoid passing around instance pointers via Haxe (which would be a bit messy). Because the PhysicsWorld trait sets the debug mode when it's instantiated and it is instantiated again when switching scenes, the global instance is updated correctly when switching scenes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants