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

Malek/omi physics bevy main #337

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

MalekiRe
Copy link

Objective

  • Describe the objective or issue this PR addresses.
  • If you're fixing a specific issue, say "Fixes #X".

Solution

  • Describe the solution used to achieve the objective above.

Changelog

This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section.

  • What changed as a result of this PR?
  • If applicable, organize changes under "Added", "Changed", or "Fixed" sub-headings
  • Stick to one or two sentences. If more detail is needed for a particular change, consider adding it to the "Solution" section
    • If you can't summarize the work, your change may be unreasonably large / unrelated. Consider splitting your PR to make it easier to review and merge!

Migration Guide

This section is optional. If there are no breaking changes, you can delete this section.

  • If this PR is a breaking change (relative to the last release), describe how a user might need to migrate their code to support these changes.
  • Simply adding new functionality is not a breaking change.
  • Fixing behavior that was definitely a bug, rather than a questionable design choice is not a breaking change.

Jondolf and others added 26 commits November 30, 2023 22:15
# Objective

Support creating colliders from the new geometric primitives in Bevy 0.13.

## Solution

Add an `IntoCollider` trait and implement it for primitives. For now, tori and conical frusta are not supported, as they aren't as trivial to implement.

Some new collider shapes are also supported: ellipses and regular polygons. These are implemented using custom shapes, as Parry doesn't have them built-in.

`Collider::ball` is now also `Collider::circle` in 2D and `Collider::sphere` in 3D. `Collider::cuboid` is `Collider::rectangle` in 2D. This makes the naming consistent with Bevy. 

---

## Migration Guide

- Replace `Collider::ball` with `Collider::circle` in 2D and `Collider::sphere` in 3D
- Replace `Collider::cuboid` with `Collider::rectangle` in 2D
…:from_ray` (Jondolf#329)

# Objective

Bevy 0.13 added the `Direction2d` and `Direction3d` types along with `Ray2d` and `Ray3d` types. The new direction types are a great fit for ray directions, as they guarantee that the direction is normalized. This avoids the potential footgun where unnormalized directions are actually treated like velocity, which affects the time of impact.

Ray and shape casting APIs should use the direction types. It should also be possible to make a `RayCaster` from a ray conveniently.

## Solution

Add `Ray` and `Dir` type aliases to support 2D and 3D, and use `Dir` for directions for `RayCaster`, `ShapeCaster`, and `SpatialQuery` methods. I also added a `RayCaster::from_ray` constructor.

---

## Migration Guide

For spatial queries, replace `Vec2`/`Vec3` directions with `Direction2d`/`Direction3d`.

```rust
// Before
let caster = RayCaster::new(Vec3::ZERO, Vec3::X);

// After
let caster = RayCaster::new(Vec3::ZERO, Direction3d::X);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants