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

Fix inconsistency between collider constructors and Bevy's primitives #394

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Jul 3, 2024

Objective

The new constructors for Bevy's Cylinder, Capsule, and Cone shapes take a radius first, and a height second.

Capsule::new(radius, height)

However, our collider constructors use the opposite order:

Collider::capsule(height, radius)

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, and Cone, the order of arguments has changed for some Collider constructors.

  • Use Collider::cylinder(radius, height) instead of Collider::cylinder(height, radius).
  • Use Collider::capsule(radius, height) instead of Collider::capsule(height, radius).
  • Use Collider::capsule_endpoints(radius, a, b) instead of Collider::capsule_endpoints(a, b, radius).
  • Use Collider::cone(radius, height) instead of Collider::cone(height, radius).

@Jondolf Jondolf added A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Breaking-Change This change removes or changes behavior or APIs, requiring users to adapt labels Jul 3, 2024
@Jondolf Jondolf merged commit 9154591 into avian Jul 3, 2024
4 checks passed
@Jondolf Jondolf deleted the collider-constructor-consistency branch July 3, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Breaking-Change This change removes or changes behavior or APIs, requiring users to adapt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants