Add JointGraph and JointCollisionDisabled#799
Merged
Merged
Conversation
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.
Objective
Resolves #259.
Closes #274.
A common requirement when using joints is to disable collisions between the attached bodies, for example a wheel and a car. Collision layers are typically not suitable for this, as you may still want a car to collide with the wheels of other cars. Implementing the desired behavior properly requires custom hooks, which is both inefficient and overly complicated for such a common scenario.
We should have a first-party
JointCollisionDisabledcomponent. To implement it efficiently, we also need to maintain an internalJointGraphto track which joints are connected to which bodies. A joint graph is also needed for #578.Solution
JointGraphthat is managed for each joint with aJointGraphPlugin<T: Joint>. To make it work properly, a single entity can now only hold up to one type of joint component. If a joint is added on an entity that already has a joint, the old joint is automatically removed, and a warning is emitted ifdebug_assertionsare enabled.JointCollisionDisabledcomponent for disabling collisions between bodies attached by joints.Migration Guide
Entities can now only hold up to one type of joint component. If a joint is added on an entity that already has a joint, the old joint is automatically removed, and a warning is emitted if
debug_assertionsare enabled. A rigid body can still be attached to other bodies by multiple joints, but each joint must be on its own entity.ContactEdgenow also stores the rigid body entities.