Fix inconsistency between collider constructors and Bevy's primitives #394
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
The
new
constructors for Bevy'sCylinder
,Capsule
, andCone
shapes take a radius first, and a height second.However, our collider constructors use the opposite order:
The reason for this is that I originally followed Parry's argument ordering, and Bevy's primitive shapes were added afterwards with a different ordering.
This is a very unfortunate inconsistency and can easily lead to confusion. Even though changing this will lead to very clear breakage for a large number of applications, I believe it is important that we align ourselves with Bevy here.
Solution
Make the argument ordering for all collider constructors match Bevy.
Migration Guide
To match Bevy's
Cylinder
,Capsule
, andCone
, the order of arguments has changed for someCollider
constructors.Collider::cylinder(radius, height)
instead ofCollider::cylinder(height, radius)
.Collider::capsule(radius, height)
instead ofCollider::capsule(height, radius)
.Collider::capsule_endpoints(radius, a, b)
instead ofCollider::capsule_endpoints(a, b, radius)
.Collider::cone(radius, height)
instead ofCollider::cone(height, radius)
.