feat(physics): Support Dynamic bodies #927
Merged
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.