feat(physics): Support Dynamic bodies#927
Merged
zicklag merged 2 commits intofishfolk:mainfrom Mar 21, 2024
Merged
Conversation
dynamic not having gravity applied (not going into active dynamic set). Update physics debug rendering code as rapier::DebugRenderObject changed in updated version.
zicklag
approved these changes
Mar 21, 2024
Member
zicklag
left a comment
There was a problem hiding this comment.
Nice. I like how small this diff is. 🚀
Collaborator
Author
There's more haha but going in logical chunks at least so it's not a massive change soup :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the base of core changes to support ragdolls, allows us to simulate dynamic bodies in rapier.
DynamicBody component may be added to an entity that has KinematicBody, and if enabled, body will simulate physics. Transitioning between kinematic / dynamic and adjusting rapier data + collider is handled on next physics update.
This change should have no impact on existing kinematics, scene queries, etc. Usage of these changes will come in other PR soon.
Switched to fork of rapier (temporarily hopefully):
I switched us to a fork of rapier to fix a bug in which changing a rapier rigidbody from kinematic to dynamic will not put it in active dynamic set, so gravity is not applied. It seems they rely on contact graph to add body to this set, but if not in contact with anything it breaks. I have a PR open for a fix in rapier.
Some notes on changes:
There's a decent chunk of physics stuff in collision module now, at some point maybe should detangle this, but probably fine for now. I renamed some functions to make things more clear.