Skip to content

Commit

Permalink
Add old methods back as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondolf committed Feb 17, 2024
1 parent 3fb84ec commit 9683717
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/components/collider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,19 @@ impl Collider {
SharedShape::ball(radius).into()
}

/// Creates a collider with a ball shape defined by its radius.
#[cfg_attr(
feature = "2d",
deprecated(since = "0.4.0", note = "please use `Collider::circle` instead")
)]
#[cfg_attr(
feature = "3d",
deprecated(since = "0.4.0", note = "please use `Collider::sphere` instead")
)]
pub fn ball(radius: Scalar) -> Self {
SharedShape::ball(radius).into()
}

/// Creates a collider with an ellipse shape defined by a half-width and half-height.
#[cfg(feature = "2d")]
pub fn ellipse(half_width: Scalar, half_height: Scalar) -> Self {
Expand All @@ -483,6 +496,13 @@ impl Collider {
SharedShape::cuboid(x_length * 0.5, y_length * 0.5).into()
}

/// Creates a collider with a ball shape defined by its radius.
#[cfg(feature = "2d")]
#[deprecated(since = "0.4.0", note = "please use `Collider::rectangle` instead")]
pub fn cuboid(x_length: Scalar, y_length: Scalar) -> Self {
SharedShape::cuboid(x_length * 0.5, y_length * 0.5).into()
}

/// Creates a collider with a cuboid shape defined by its extents.
#[cfg(feature = "3d")]
pub fn cuboid(x_length: Scalar, y_length: Scalar, z_length: Scalar) -> Self {
Expand All @@ -495,6 +515,16 @@ impl Collider {
SharedShape::round_cuboid(x_length * 0.5, y_length * 0.5, border_radius).into()
}

/// Creates a collider with a ball shape defined by its radius.
#[cfg(feature = "2d")]
#[deprecated(
since = "0.4.0",
note = "please use `Collider::round_rectangle` instead"
)]
pub fn round_cuboid(x_length: Scalar, y_length: Scalar, border_radius: Scalar) -> Self {
SharedShape::round_cuboid(x_length * 0.5, y_length * 0.5, border_radius).into()
}

/// Creates a collider with a cuboid shape defined by its extents and rounded corners.
#[cfg(feature = "3d")]
pub fn round_cuboid(
Expand Down

0 comments on commit 9683717

Please sign in to comment.