From eae6526699ce2d75628dd4dff5e0eac8164ea2b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 17 Mar 2024 21:27:46 +0100 Subject: [PATCH] Start experimenting with the bevy/glam versions of rapier/parry More wrapper removal --- CHANGELOG.md | 174 +- Cargo.toml | 16 +- bevy_rapier2d/Cargo.toml | 34 +- bevy_rapier3d/Cargo.toml | 40 +- bevy_rapier3d/examples/ray_casting3.rs | 8 +- bevy_rapier3d/examples/static_trimesh3.rs | 2 +- src/control/character_controller.rs | 76 +- src/dynamics/fixed_joint.rs | 141 -- src/dynamics/generic_joint.rs | 451 ---- src/dynamics/joint.rs | 27 +- src/dynamics/mod.rs | 20 - src/dynamics/prismatic_joint.rs | 260 --- src/dynamics/revolute_joint.rs | 251 --- src/dynamics/rigid_body.rs | 318 +-- src/dynamics/rope_joint.rs | 269 --- src/dynamics/spherical_joint.rs | 240 --- src/dynamics/spring_joint.rs | 149 -- src/geometry/collider.rs | 365 +--- src/geometry/collider_impl.rs | 459 ++-- src/geometry/mod.rs | 117 -- src/geometry/shape_views/ball.rs | 37 - src/geometry/shape_views/capsule.rs | 89 - src/geometry/shape_views/collider_view.rs | 410 ---- src/geometry/shape_views/compound.rs | 21 - src/geometry/shape_views/cone.rs | 47 - src/geometry/shape_views/convex_polygon.rs | 41 - src/geometry/shape_views/convex_polyhedron.rs | 33 - src/geometry/shape_views/cuboid.rs | 37 - src/geometry/shape_views/cylinder.rs | 47 - src/geometry/shape_views/halfspace.rs | 40 - src/geometry/shape_views/heightfield.rs | 176 -- src/geometry/shape_views/mod.rs | 41 - src/geometry/shape_views/polyline.rs | 59 - src/geometry/shape_views/round_shape.rs | 119 -- src/geometry/shape_views/segment.rs | 99 - src/geometry/shape_views/triangle.rs | 106 - src/geometry/shape_views/trimesh.rs | 65 - src/lib.rs | 17 + src/pipeline/events.rs | 83 +- src/pipeline/mod.rs | 4 +- src/pipeline/physics_hooks.rs | 108 +- src/pipeline/query_filter.rs | 112 +- src/plugin/context.rs | 519 ++--- src/plugin/mod.rs | 1 - src/plugin/narrow_phase.rs | 362 ---- src/plugin/plugin.rs | 34 +- src/plugin/systems.rs | 1852 ----------------- src/plugin/systems/character_controller.rs | 156 ++ src/plugin/systems/collider.rs | 457 ++++ src/plugin/systems/joints.rs | 84 + src/plugin/systems/mod.rs | 352 ++++ src/plugin/systems/removals.rs | 135 ++ src/plugin/systems/rigid_body.rs | 387 ++++ src/plugin/systems/simulate.rs | 48 + src/plugin/systems/writeback.rs | 192 ++ src/render/mod.rs | 31 +- src/utils/mod.rs | 30 +- 57 files changed, 2521 insertions(+), 7327 deletions(-) delete mode 100644 src/dynamics/fixed_joint.rs delete mode 100644 src/dynamics/generic_joint.rs delete mode 100644 src/dynamics/prismatic_joint.rs delete mode 100644 src/dynamics/revolute_joint.rs delete mode 100644 src/dynamics/rope_joint.rs delete mode 100644 src/dynamics/spherical_joint.rs delete mode 100644 src/dynamics/spring_joint.rs delete mode 100644 src/geometry/shape_views/ball.rs delete mode 100644 src/geometry/shape_views/capsule.rs delete mode 100644 src/geometry/shape_views/collider_view.rs delete mode 100644 src/geometry/shape_views/compound.rs delete mode 100644 src/geometry/shape_views/cone.rs delete mode 100644 src/geometry/shape_views/convex_polygon.rs delete mode 100644 src/geometry/shape_views/convex_polyhedron.rs delete mode 100644 src/geometry/shape_views/cuboid.rs delete mode 100644 src/geometry/shape_views/cylinder.rs delete mode 100644 src/geometry/shape_views/halfspace.rs delete mode 100644 src/geometry/shape_views/heightfield.rs delete mode 100644 src/geometry/shape_views/mod.rs delete mode 100644 src/geometry/shape_views/polyline.rs delete mode 100644 src/geometry/shape_views/round_shape.rs delete mode 100644 src/geometry/shape_views/segment.rs delete mode 100644 src/geometry/shape_views/triangle.rs delete mode 100644 src/geometry/shape_views/trimesh.rs delete mode 100644 src/plugin/narrow_phase.rs delete mode 100644 src/plugin/systems.rs create mode 100644 src/plugin/systems/character_controller.rs create mode 100644 src/plugin/systems/collider.rs create mode 100644 src/plugin/systems/joints.rs create mode 100644 src/plugin/systems/mod.rs create mode 100644 src/plugin/systems/removals.rs create mode 100644 src/plugin/systems/rigid_body.rs create mode 100644 src/plugin/systems/simulate.rs create mode 100644 src/plugin/systems/writeback.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index d8864a6e..1fb24717 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,32 @@ # Changelog +## Unreleased + +### Modified + +- Renamed the `Sleeping` component to `SleepState`. +- Renamed the `RapierRigidBodyHandle` component to `RigidBodyHandle` (the wrapper got replaced by the + original Rapier type). +- Renamed the `RapierColliderHandle` component to `ColliderHandle` (the wrapper got replaced by the + original Rapier type). +- Renamed the `RapierImpulseJointHandle` component to `ImpulseJointHandle` (the wrapper got replaced by the + original Rapier type). +- Renamed the `RapierMultibodyJointHandle` component to `MultibodyJointHandle` (the wrapper got replaced by the + original Rapier type). + ## v0.25.0 (19 Feb. 2024) ### Modified + - Update to bevy `0.13`. ## v0.24.0 (27 Jan. 2024) + The main highlight of this release is the implementation of a new non-linear constraints solver for better stability and increased convergence rates. See [#579](https://github.com/dimforge/rapier/pull/579) for additional information. -In order to adjust the number of iterations of the new solver, simply adjust `IntegrationParameters::num_solver_iterations`. +In order to adjust the number of iterations of the new solver, simply +adjust `IntegrationParameters::num_solver_iterations`. If recovering the old solver behavior is useful to you, call `IntegrationParameters::switch_to_standard_pgs_solver()`. It is now possible to specify some additional solver iteration for specific rigid-bodies (and everything interacting @@ -18,26 +35,34 @@ same entity as the rigid-body. This allows for higher-accuracy on subsets of the performance of the other parts of the simulation. ### Fix -- Fix bug causing angular joint limits and motor to sometimes only take into account half of the angles specified by the user. + +- Fix bug causing angular joint limits and motor to sometimes only take into account half of the angles specified by the + user. - Fix bug where collisions would not be re-computed after a collider was re-enabled. ### Added -- Add a `SpringJoint` and `SpringJointBuilder` for simulating springs with customizable stiffness and damping coefficients. + +- Add a `SpringJoint` and `SpringJointBuilder` for simulating springs with customizable stiffness and damping + coefficients. - Fix incorrect update of angular degrees-of-freedoms on spherical multibody joints. - Fix debug-renderer showing moved kinematic rigid-bodies only at their initial position. ### Modified + - Rename `RapierContext::contacts_with` to `RapierContext::contact_pairs_with`. - Rename `RapierContext::intersections_with` to `RapierContext::intersection_pairs_with`. - Collisions between the character controller and sensors are now disabled by default. ## 0.23.0 + ### Modified + - Update to Bevy 0.12 ### Added + - `ColliderView::as_typed_shape` and `::to_shared_shape` to convert a `ColliderView` to a parry’s - `TypedShape` or `SharedShape`. The `From` trait has also been implemented accordingly. + `TypedShape` or `SharedShape`. The `From` trait has also been implemented accordingly. - Implement `Copy` for `ColliderView` and all the other non-mut shape views. - Add `RapierContext::rigid_body_colliders` to retrieve all collider entities attached to this rigid-body. - Add `RapierPhysicsPlugin::in_fixed_schedule`/`::in_schedude` to add rapier’s systems to a fixed/custom @@ -48,24 +73,29 @@ performance of the other parts of the simulation. of the shape. ### Fix + - Fix `RapierContext::integration_parameters::dt` not being updated on non-fixed timestep modes. - Fix debug-renderer lagging one frame behind. - Fix Collider `Transform` rotation change not being taken into account by the physics engine. - Fix automatic update of `ReadMassProperties`. ## 0.22.0 (10 July 2023) + ### Modified + - Update to Bevy 0.11. - Disabled rigid-bodies are no longer synchronized with the rapier backend. - Switch to bevy’s gizmo system for the debug-renderer. This removes the vendored debug lines plugin. ### Added + - Add a joint for simulating ropes: the `RopeJoint`. - Add `Velocity::linear_velocity_at_point` to calculate the linear velocity at the given world-space point. - Add the `ComputedColliderShape::ConvexHull` variant to automatcially calculate the convex-hull of an imported mesh. - Implement `Reflect` for the debug-renderer. ### Fix + - Fix broken interpolation for rigid-bodies with the `TransformInterpolation` component. - Fix compilation when `bevy_rapier` is being used with headless bevy. - Improved performance of the writeback system by not iterting on non-rigid-body entities. @@ -73,7 +103,9 @@ performance of the other parts of the simulation. - Properly scale parented collider’s offset based on changes on its `ColliderScale`. ## 0.21.0 (07 March 2023) + ### Modified + - Update to Bevy 0.10. - The `PhysicsHooksWithQuery` trait has been renamed to by the `BevyPhysicsHooks`. - Bevy resources and queries accessed by the physics hook are now specified by the implementor of `BevyPhysicsHooks` @@ -83,32 +115,43 @@ performance of the other parts of the simulation. - Rename `PhysicsStages` to `PhysicsSet`. ## 0.20.0 (15 Jan. 2023) + ### Added + - Add the `RigidBodyDisabled` and `ColliderDisabled` component that can be inserted to disable a rigid-body or collider without removing it from the scene. ### Fix + - Fix spawn position of colliders without rigid bodies. - Fix overriding enabled flag in debug render. ### Modified -- Make debug-rendering enabled by default when inserting the `RapierDebugRenderPlugin` plugin with its default configuration. -- The `debug-render` feature has been replaced by two features: `debug-render-2d` and `debug-render-3d`. For example, - using `debug-render-2d` with `bevy_rapier3d`, the debug-render will work with 2D cameras (useful, e.g., for top-down games + +- Make debug-rendering enabled by default when inserting the `RapierDebugRenderPlugin` plugin with its default + configuration. +- The `debug-render` feature has been replaced by two features: `debug-render-2d` and `debug-render-3d`. For example, + using `debug-render-2d` with `bevy_rapier3d`, the debug-render will work with 2D cameras (useful, e.g., for top-down + games with 3D graphics). - In order to facilitate the use of `bevy_rapier` in headless mode, the `AsyncCollider` and `AsyncSceneCollider` components were moved behind the `async-collider` feature (enabled by default). Disabling that feature will make `bevy_rapier` work even with the `MinimalPlugins` inserted instead of the `DefaultPlugins`. -- Corrected an API inconsistency where `bevy_rapier` components would sometimes require an `InteracitonGroup` type defined in +- Corrected an API inconsistency where `bevy_rapier` components would sometimes require an `InteracitonGroup` type + defined in `rapier`. It has been replaced by the `CollisionGroup` type (defined in `bevy_rapier`). - `Velocity::zero,linear,angular` are now const-fn. ## 0.19.0 (18 Nov. 2022) + ### Modified + - Update to Bevy 0.9 ## 0.18.0 (30 Oct. 2022) + ### Added + - Add the accessor `RapierContext::physics_scale()` to read the physics scale that was set when initializing the plugin. - Add `RapierConfiguration::force_update_from_transform_changes` to force the transform @@ -118,8 +161,9 @@ performance of the other parts of the simulation. flags. ### Fix + - Reset the `ExternalImpulse` component after each step automatically. -- Fix `transform_to_iso` to preserve identical rotations instead of +- Fix `transform_to_iso` to preserve identical rotations instead of converting to an intermediate axis-angle representation. - Fix **internal edges** of 3D triangle meshes or 3D heightfields generating invalid contacts preventing balls from moving straight. Be sure to set the triangle mesh flag @@ -127,47 +171,59 @@ performance of the other parts of the simulation. vertices. ### Modified + - Rename `AABB` to `Aabb` to comply with Rust’s style guide. ## 0.17.0 (02 Oct. 2022) + ### Added + - Add a **kinematic character controller** implementation. This feature is accessible in two different ways: - 1. The first approach is to insert the `KinematicCharacterController` component to an entity. If the - `KinematicCharacterController::custom_shape` field is set, then this shape is used for the character control. - If this field is `None` then the `Collider` attached to the same entity as the character controller is used. - The character controller will be automatically updated when the `KinematicCharacterController::movement` is set. - The result position is written to the `Transform` of the character controller’s entity. - 2. The second, lower level, approach, is to call `RapierContext::move_shape` to compute the possible movement - of a shape, taking obstacle and sliding into account. + 1. The first approach is to insert the `KinematicCharacterController` component to an entity. If the + `KinematicCharacterController::custom_shape` field is set, then this shape is used for the character control. + If this field is `None` then the `Collider` attached to the same entity as the character controller is used. + The character controller will be automatically updated when the `KinematicCharacterController::movement` is set. + The result position is written to the `Transform` of the character controller’s entity. + 2. The second, lower level, approach, is to call `RapierContext::move_shape` to compute the possible movement + of a shape, taking obstacle and sliding into account. - Add implementations of `Add`, `AddAssign`, `Sub`, `SubAssign` to `ExternalForce` and `ExternalImpulse`. - Add `ExternalForce::at_point` and `ExternalImpulse::at_point` to apply a force/impulse at a specific point of a rigid-body. ### Fix + - Fix shapes quickly switching between scaled and non-scaled versions due to rounding errors in the scaling extraction from bevy’s global affine transform. ## 0.16.2 (23 August 2022) + ### Added + - Implement `Debug` for `Collider` and `ColliderView`. - Add the missing `ActiveEvent::CONTACT_FORCE_EVENTS` to enable contact force events on a collider. ## 0.16.1 (19 August 2022) + ### Fixed + - Fix crash of the 2D debug-render on certain platforms (including Metal/MacOS). - Fix bug where collision events and contact force events were not cleared automatically. - Implement `Reflect` for `AsyncCollider`. ## 0.16.0 (31 July 2022) + ### Modified + - Switch to Bevy 0.8. ## 0.15.0 (10 July 2022) + ### Fixed + - Fix unpredictable broad-phase panic when using small colliders in the simulation. - Fix collision events being incorrectly generated for any shape that produces multiple contact manifolds (like triangle meshes). -- Fix transform hierarchies not being properly taken into account for colliders with a +- Fix transform hierarchies not being properly taken into account for colliders with a parent rigid-body. - Fix force and impulse application when the `ExternalImpulse` or `ExternalForce` components were added at the same time as the rigid-body creation. @@ -175,21 +231,24 @@ performance of the other parts of the simulation. creation. ### Added -- Add the `ColliderMassProperties::Mass` variant to let the user specify a collider’s mass directly (instead of its density). + +- Add the `ColliderMassProperties::Mass` variant to let the user specify a collider’s mass directly (instead of its + density). As a result the collider’s angular inertia tensor will be automatically be computed based on this mass and its shape. - Add the `ContactForceEvent` event. It can be read by a bevy system with the `EventReader`. This event is useful to read contact forces. A `ContactForceEvent` is generated whenever the sum of the magnitudes of the forces applied by contacts between two colliders exceeds the value specified by the `ContactForceEventThreshold` component. - Add the `QueryFilter` struct that is now used by all the scene queries instead of the `CollisionGroups` and - `Fn(Entity) -> bool` closure. This `QueryFilter` provides easy access to most common filtering strategies - (e.g. dynamic bodies only, excluding one particular entity, etc.) for scene queries. + `Fn(Entity) -> bool` closure. This `QueryFilter` provides easy access to most common filtering strategies + (e.g. dynamic bodies only, excluding one particular entity, etc.) for scene queries. - Added some missing serialization of joints. - Implement `Default` for `Collider`. It defaults to a `Ball` with radius 0.5. -- Added a `contacts_enabled` flag to all the joints. If this flag is set to `false` for a joint, no contact will be +- Added a `contacts_enabled` flag to all the joints. If this flag is set to `false` for a joint, no contact will be computed between two colliders attached to rigid-bodies liked by that joint. ### Modified + - The `MassProperties` struct is no longer a `Component`. A common mistake was to assume that `MassProperties` could be used to initialize the mass/angular inertia tensor of a rigid-body. It is not the case. Instead, the user should use the `AdditionalMassProperties` component. The `ReadMassProperties` component has been added to read the mass @@ -198,41 +257,54 @@ performance of the other parts of the simulation. a solid collider. ## 0.14.1 (01 June 2022) + ### Fixed + - Add the missing `init_async_scene_colliders` to the list of the plugin systems. ## 0.14.0 (31 May 2022) + ### Added + - Add the `AsyncSceneCollider` component to generate collision for scene meshes similar to `AsyncCollider`. - Add calls to `App::register_type` for the types implementing `Reflect`. ### Modified -- `Collider::bevy_mesh`, `Collider::bevy_mesh_convex_decomposition` and `Collider::bevy_mesh_convex_decomposition_with_params` was replaced with single `Collider::from_bevy_mesh` function which accepts `ComputedColliderShape`. + +- `Collider::bevy_mesh`, `Collider::bevy_mesh_convex_decomposition` + and `Collider::bevy_mesh_convex_decomposition_with_params` was replaced with single `Collider::from_bevy_mesh` + function which accepts `ComputedColliderShape`. - `AsyncCollider` is now a struct which contains a mesh handle and `ComputedColliderShape`. - The physics systems are now running after `CoreStage::Update` but before `CoreStage::PostUpdate`. -- The collider and rigid-body positions are read from the `GlobalTransform` instead of `Transform` (the +- The collider and rigid-body positions are read from the `GlobalTransform` instead of `Transform` (the transforms modified by Rapier are written back to the `Transform` component). It is therefore important to insert both a `Transform` and `GlobalTransform` component (or the `TransformBundle` bundle). -- It is now possible to prevent the plugin from registering its system thanks to `RapierPhysicsPlugin::with_default_system_setup(false)`. +- It is now possible to prevent the plugin from registering its system thanks + to `RapierPhysicsPlugin::with_default_system_setup(false)`. If that’s the case, the `RapierPhysicsPlugin::get_systems` method can be called to retrieve the relevant `SystemSet` that can be added to your own stages in order to apply your own scheduling. ### Fixed + - Fixed issues where contact regularization (using compliance) would result in tunnelling despite tunnelling being enabled. - Don’t overwrite the user’s `RapierConfiguration` if one already exists before initializing the plugin. ## 0.13.2 (5 May 2022) + ### Modified + - The `TimestepMode` and `SimulationToRenderTime` structures are now public. ### Fixed + - Fixed colors rendered by the debug-renderer. - Fix issue where the debug-renderer would sometimes render lines behind the user’s meshes/sprites. - ## 0.13.1 (1 May 2022) + ### Added + - Add the `CollidingEntities` components which tracks the set of entities colliding with a given entity. - Add constructors `Velocity::linear`, `Velocity::angular`, `Ccd::enabled()`, `Ccd::disabled()`, @@ -242,11 +314,12 @@ performance of the other parts of the simulation. of a collider. ### Modified + - Switched to linear ordering to order our systems. - Make the `plugin::systems` module public. - ## 0.13.0 (30 Apr. 2022) + This is a **complete rewrite of the plugin** (mostly likely the last large redesign this plugin will be subject to). It switches to `rapier` 0.12 and `bevy` 0.7. The focus of this rewrite was to significantly improve ergonomics while simplifying the codebase and adding new features. @@ -256,7 +329,9 @@ on this change. See the folders `bevy_rapier2d/examples` and `bevy_rapier3d/exam for some examples. ## 0.12.0 + ### Modified + - Switch to `rapier` 0.12.0-alpha.0 and `nalgebra` 0.30. - Switch to `bevy` 0.6. - All the Rapier components have been wrapped into wrapper types (for example `ColliderPosition` @@ -266,25 +341,33 @@ for some examples. for details. ## 0.11.0 + ### Modified + - Switch to `Rapier` 0.11 and `nalgebra` 0.29. - Add labels to each system from `bevy-rapier`. ### Fixed + - Fix panics when despawning joints or colliders. - Fix a panic where adding a collider. -- Don’t let the plugin overwrite the user’s `PhysicsHooksWithQueryObject` if it was already +- Don’t let the plugin overwrite the user’s `PhysicsHooksWithQueryObject` if it was already present before inserting the plugin. ## 0.10.2 + ### Fixed + - Fix build when targeting WASM. ## 0.10.1 + ### Fixed + - Fix joint removal when despawning its entity. ## 0.10.0 + A new, exhaustive, user-guide for bevy_rapier has been uploaded to rapier.rs. This version is a complete rewrite of the plugin. Rigid-bodies and @@ -296,17 +379,21 @@ converted directly using `entity.handle()` or `handle.entity()`. Finally, there is now a prelude: `use bevy_rapier2d::prelude::*`. - ## 0.9.0 + ### Added + - The `ColliderDebugRender` component must be added to an entity containing a collider shape in order to render it. - + ## 0.8.0 + ### Changed + - Use the version 0.5.0 of Rapier. ### Added + - The debug rendering of 3D trimesh now work. - The debug rendering won't crash any more if a not-yet-supported shape is used. It will silently ignore the shape instead. @@ -315,58 +402,75 @@ Finally, there is now a prelude: `use bevy_rapier2d::prelude::*`. targetting WASM). ## 0.7.0 + ### Changed + - Use the version 0.4.0 of Bevy. ## 0.6.2 + ### Changed + - Fix the rendering of colliders attached to an entity children of another entity containing the rigid-body it is attached to. ## 0.6.1 + ### Changed + - The adaptive change of number of timesteps executed during each render loop (introduced in the version 0.4.0 with position interpolation) is now disabled by default. It needs to be enabled explicitly by setting `RapierConfiguration.time_dependent_number_of_timesteps` to `true`. ## 0.6.0 + ### Added + - It is now possible to attach multiple colliders to a single rigid-body by using Bevy hierarchy: an entity contains - the `RigidBodyBuider` whereas its children contain the `ColliderBuilder`. + the `RigidBodyBuider` whereas its children contain the `ColliderBuilder`. ### Changed + - We now use the latest version of Rapier: 0.4.0. See the [Rapier changelog](https://github.com/dimforge/rapier/blob/master/CHANGELOG.md#v040) for details. In particular, this includes the ability to lock the rotations of a rigid-body. ## 0.5.0 + ### Changed + - We now use the latest version of Bevy: 0.3.0 ### Added + - Rigid-bodies, colliders, and joints, will automatically removed from the Rapier sets when their corresponding Bevy components are removed. ## 0.4.0 + This release update the plugin to the latest version of Rapier, which itself includes lots of new features. Refer to the Rapier changelogs for details. ### Added + - A `InteractionPairFilters` resource where you can your own filters for contact pair -and proximity pair filtering. Before considering the use of a custom filter, consider -using collision groups instead (as it is faster, but less versatile). + and proximity pair filtering. Before considering the use of a custom filter, consider + using collision groups instead (as it is faster, but less versatile). ### Changed + - The stepping system now applies interpolation between two physics state at render time. Refer to [that issue](https://github.com/dimforge/bevy_rapier/pull/19) and the following blog post article for details: https://www.gafferongames.com/post/fix_your_timestep/ ## 0.3.1 + ### Changed + - Rapier configuration - - Replaced `Gravity` and `RapierPhysicsScale` resources with a unique `RapierConfiguration` resource. - - Added an `physics_pipeline_active` attribute to `RapierConfiguration` allowing to pause the physic simulation. - - Added a `query_pipeline_active` attribute to `RapierConfiguration` allowing to pause the query pipeline update. + - Replaced `Gravity` and `RapierPhysicsScale` resources with a unique `RapierConfiguration` resource. + - Added an `physics_pipeline_active` attribute to `RapierConfiguration` allowing to pause the physic simulation. + - Added a `query_pipeline_active` attribute to `RapierConfiguration` allowing to pause the query pipeline update. diff --git a/Cargo.toml b/Cargo.toml index a0431007..9feda8b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,21 +3,25 @@ members = ["bevy_rapier2d", "bevy_rapier3d"] resolver = "2" [profile.dev] - # Use slightly better optimization by default, as examples otherwise seem laggy. +# Use slightly better optimization by default, as examples otherwise seem laggy. opt-level = 1 [profile.release] codegen-units = 1 [patch.crates-io] +#simba = { path = "../simba" } #nalgebra = { path = "../nalgebra" } #parry2d = { path = "../parry/crates/parry2d" } #parry3d = { path = "../parry/crates/parry3d" } #rapier2d = { path = "../rapier/crates/rapier2d" } #rapier3d = { path = "../rapier/crates/rapier3d" } -#nalgebra = { git = "https://github.com/dimforge/nalgebra", branch = "dev" } -#parry2d = { git = "https://github.com/dimforge/parry", branch = "master" } -#parry3d = { git = "https://github.com/dimforge/parry", branch = "master" } -#rapier2d = { git = "https://github.com/dimforge/rapier", branch = "character-controller" } -#rapier3d = { git = "https://github.com/dimforge/rapier", branch = "character-controller" } \ No newline at end of file + + +simba = { git = "https://github.com/dimforge/simba", rev = "7b50b3eb568e9c551431286a95c913a7057de58f" } +nalgebra = { git = "https://github.com/dimforge/nalgebra", rev = "25032f089bb2e8a8bd2c1d419f1613911a042895" } +parry2d = { git = "https://github.com/dimforge/parry", rev = "c0e6f8032396396f93b5ad687504bed9d676aaee" } +parry3d = { git = "https://github.com/dimforge/parry", rev = "c0e6f8032396396f93b5ad687504bed9d676aaee" } +rapier2d = { git = "https://github.com/dimforge/rapier", rev = "ecd308338b189ab569816a38a03e3f8b89669dde" } +rapier3d = { git = "https://github.com/dimforge/rapier", rev = "ecd308338b189ab569816a38a03e3f8b89669dde" } \ No newline at end of file diff --git a/bevy_rapier2d/Cargo.toml b/bevy_rapier2d/Cargo.toml index 08d319b4..15cce6b9 100644 --- a/bevy_rapier2d/Cargo.toml +++ b/bevy_rapier2d/Cargo.toml @@ -7,7 +7,7 @@ documentation = "http://docs.rs/bevy_rapier2d" homepage = "http://rapier.rs" repository = "https://github.com/dimforge/bevy_rapier" readme = "../README.md" -keywords = [ "physics", "dynamics", "rigid", "real-time", "joints" ] +keywords = ["physics", "dynamics", "rigid", "real-time", "joints"] license = "Apache-2.0" edition = "2021" @@ -15,36 +15,36 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] path = "../src/lib.rs" -required-features = [ "dim2" ] +required-features = ["dim2"] [features] -default = [ "dim2", "async-collider", "debug-render-2d" ] +default = ["dim2", "async-collider", "debug-render-2d"] dim2 = [] -debug-render-2d = [ "bevy/bevy_core_pipeline", "bevy/bevy_sprite", "bevy/bevy_gizmos", "rapier2d/debug-render", "bevy/bevy_asset" ] -debug-render-3d = [ "bevy/bevy_core_pipeline", "bevy/bevy_pbr", "bevy/bevy_gizmos", "rapier2d/debug-render", "bevy/bevy_asset" ] -parallel = [ "rapier2d/parallel" ] -simd-stable = [ "rapier2d/simd-stable" ] -simd-nightly = [ "rapier2d/simd-nightly" ] -wasm-bindgen = [ "rapier2d/wasm-bindgen" ] -serde-serialize = [ "rapier2d/serde-serialize", "bevy/serialize", "serde" ] -enhanced-determinism = [ "rapier2d/enhanced-determinism" ] +debug-render-2d = ["bevy/bevy_core_pipeline", "bevy/bevy_sprite", "bevy/bevy_gizmos", "rapier2d/debug-render", "bevy/bevy_asset"] +debug-render-3d = ["bevy/bevy_core_pipeline", "bevy/bevy_pbr", "bevy/bevy_gizmos", "rapier2d/debug-render", "bevy/bevy_asset"] +parallel = ["rapier2d/parallel"] +simd-stable = ["rapier2d/simd-stable"] +simd-nightly = ["rapier2d/simd-nightly"] +wasm-bindgen = ["rapier2d/wasm-bindgen"] +serde-serialize = ["rapier2d/serde-serialize", "bevy/serialize", "serde"] +enhanced-determinism = ["rapier2d/enhanced-determinism"] headless = [] -async-collider = [ "bevy/bevy_asset", "bevy/bevy_scene" ] +async-collider = ["bevy/bevy_asset", "bevy/bevy_scene"] [dependencies] bevy = { version = "0.13", default-features = false } -nalgebra = { version = "0.32.3", features = [ "convert-glam025" ] } -rapier2d = "0.18.0" +nalgebra = { version = "0.32.3", features = ["convert-glam025"] } +rapier2d = { version = "0.18", features = ["linalg-glam"] } bitflags = "2.4" log = "0.4" -serde = { version = "1", features = [ "derive" ], optional = true} +serde = { version = "1", features = ["derive"], optional = true } [dev-dependencies] bevy = { version = "0.13", default-features = false, features = ["x11"] } oorandom = "11" approx = "0.5.1" -glam = { version = "0.25", features = [ "approx" ] } +glam = { version = "0.25", features = ["approx"] } [package.metadata.docs.rs] # Enable all the features when building the docs on docs.rs -features = [ "debug-render-2d", "serde-serialize" ] +features = ["debug-render-2d", "serde-serialize"] diff --git a/bevy_rapier3d/Cargo.toml b/bevy_rapier3d/Cargo.toml index 3259167c..bb739502 100644 --- a/bevy_rapier3d/Cargo.toml +++ b/bevy_rapier3d/Cargo.toml @@ -7,7 +7,7 @@ documentation = "http://docs.rs/bevy_rapier3d" homepage = "http://rapier.rs" repository = "https://github.com/dimforge/bevy_rapier" readme = "../README.md" -keywords = [ "physics", "dynamics", "rigid", "real-time", "joints" ] +keywords = ["physics", "dynamics", "rigid", "real-time", "joints"] license = "Apache-2.0" edition = "2021" @@ -15,36 +15,36 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] path = "../src/lib.rs" -required-features = [ "dim3" ] +required-features = ["dim3"] [features] -default = [ "dim3", "async-collider", "debug-render-3d" ] +default = ["dim3", "async-collider", "debug-render-3d"] dim3 = [] -debug-render = [ "debug-render-3d" ] -debug-render-2d = [ "bevy/bevy_core_pipeline", "bevy/bevy_sprite", "bevy/bevy_gizmos", "rapier3d/debug-render", "bevy/bevy_asset" ] -debug-render-3d = [ "bevy/bevy_core_pipeline", "bevy/bevy_pbr", "bevy/bevy_gizmos", "rapier3d/debug-render", "bevy/bevy_asset" ] -parallel = [ "rapier3d/parallel" ] -simd-stable = [ "rapier3d/simd-stable" ] -simd-nightly = [ "rapier3d/simd-nightly" ] -wasm-bindgen = [ "rapier3d/wasm-bindgen" ] -serde-serialize = [ "rapier3d/serde-serialize", "bevy/serialize", "serde" ] -enhanced-determinism = [ "rapier3d/enhanced-determinism" ] -headless = [ ] -async-collider = [ "bevy/bevy_asset", "bevy/bevy_scene" ] +debug-render = ["debug-render-3d"] +debug-render-2d = ["bevy/bevy_core_pipeline", "bevy/bevy_sprite", "bevy/bevy_gizmos", "rapier3d/debug-render", "bevy/bevy_asset"] +debug-render-3d = ["bevy/bevy_core_pipeline", "bevy/bevy_pbr", "bevy/bevy_gizmos", "rapier3d/debug-render", "bevy/bevy_asset"] +parallel = ["rapier3d/parallel"] +simd-stable = ["rapier3d/simd-stable"] +simd-nightly = ["rapier3d/simd-nightly"] +wasm-bindgen = ["rapier3d/wasm-bindgen"] +serde-serialize = ["rapier3d/serde-serialize", "bevy/serialize", "serde"] +enhanced-determinism = ["rapier3d/enhanced-determinism"] +headless = [] +async-collider = ["bevy/bevy_asset", "bevy/bevy_scene"] [dependencies] bevy = { version = "0.13", default-features = false } -nalgebra = { version = "0.32.3", features = [ "convert-glam025" ] } -rapier3d = "0.18" +nalgebra = { version = "0.32.3", features = ["convert-glam025"] } +rapier3d = { version = "0.18", features = ["linalg-glam"] } bitflags = "2.4" log = "0.4" -serde = { version = "1", features = [ "derive" ], optional = true} +serde = { version = "1", features = ["derive"], optional = true } [dev-dependencies] -bevy = { version = "0.13", default-features = false, features = ["x11", "tonemapping_luts"]} +bevy = { version = "0.13", default-features = false, features = ["x11", "tonemapping_luts"] } approx = "0.5.1" -glam = { version = "0.25", features = [ "approx" ] } +glam = { version = "0.25", features = ["approx"] } [package.metadata.docs.rs] # Enable all the features when building the docs on docs.rs -features = [ "debug-render-3d", "serde-serialize" ] +features = ["debug-render-3d", "serde-serialize"] diff --git a/bevy_rapier3d/examples/ray_casting3.rs b/bevy_rapier3d/examples/ray_casting3.rs index 4599a722..57ed1fe6 100644 --- a/bevy_rapier3d/examples/ray_casting3.rs +++ b/bevy_rapier3d/examples/ray_casting3.rs @@ -92,13 +92,7 @@ pub fn cast_ray( }; // Then cast the ray. - let hit = rapier_context.cast_ray( - ray.origin, - ray.direction.into(), - f32::MAX, - true, - QueryFilter::only_dynamic(), - ); + let hit = rapier_context.cast_ray(ray, f32::MAX, true, QueryFilter::only_dynamic()); if let Some((entity, _toi)) = hit { // Color in blue the entity we just hit. diff --git a/bevy_rapier3d/examples/static_trimesh3.rs b/bevy_rapier3d/examples/static_trimesh3.rs index 4fe085cb..175a89c3 100644 --- a/bevy_rapier3d/examples/static_trimesh3.rs +++ b/bevy_rapier3d/examples/static_trimesh3.rs @@ -137,7 +137,7 @@ pub fn ball_spawner(mut commands: Commands, time: Res