Skip to content

Commit 7b8cf4a

Browse files
authored
Merge pull request #268 from dimforge/v0.18
Release v0.18.0
2 parents 0b2732d + dddae60 commit 7b8cf4a

File tree

6 files changed

+49
-16
lines changed

6 files changed

+49
-16
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## 0.18.0 (30 Oct. 2022)
4+
### Added
5+
- Add the accessor `RapierContext::physics_scale()` to read the physics scale
6+
that was set when initializing the plugin.
7+
- Add `RapierConfiguration::force_update_from_transform_changes` to force the transform
8+
updates even if it is equal to the transform that was previously set. Useful for
9+
rollback in networked applications described in [#261](https://github.com/dimforge/bevy_rapier/pull/261).
10+
- Add `Collider::trimesh_with_flags` to create a triangle mesh collider with custom pre-processing
11+
flags.
12+
13+
### Fix
14+
- Reset the `ExternalImpulse` component after each step automatically.
15+
- Fix `transform_to_iso` to preserve identical rotations instead of
16+
converting to an intermediate axis-angle representation.
17+
- Fix **internal edges** of 3D triangle meshes or 3D heightfields generating invalid contacts
18+
preventing balls from moving straight. Be sure to set the triangle mesh flag
19+
`TriMeshFlags::MERGE_DUPLICATE_VERTICES` when creating the collider if your mesh have duplicated
20+
vertices.
21+
22+
### Modified
23+
- Rename `AABB` to `Aabb` to comply with Rust’s style guide.
24+
325
## 0.17.0 (02 Oct. 2022)
426
### Added
527
- Add a **kinematic character controller** implementation. This feature is accessible in two different ways:

bevy_rapier2d/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_rapier2d"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
authors = ["Sébastien Crozet <[email protected]>"]
55
description = "2-dimensional physics engine in Rust, official Bevy plugin."
66
documentation = "http://docs.rs/bevy_rapier2d"
@@ -32,7 +32,7 @@ enhanced-determinism = [ "rapier2d/enhanced-determinism" ]
3232
bevy = { version = "0.8.0", default-features = false, features = ["bevy_asset", "bevy_scene"] }
3333
nalgebra = { version = "^0.31.1", features = [ "convert-glam021" ] }
3434
# Don't enable the default features because we don't need the ColliderSet/RigidBodySet
35-
rapier2d = "0.15.0"
35+
rapier2d = "0.16.0"
3636
bitflags = "1"
3737
#bevy_prototype_debug_lines = { version = "0.6", optional = true }
3838
log = "0.4"

bevy_rapier3d/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_rapier3d"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
authors = ["Sébastien Crozet <[email protected]>"]
55
description = "3-dimensional physics engine in Rust, official Bevy plugin."
66
documentation = "http://docs.rs/bevy_rapier3d"
@@ -32,7 +32,7 @@ enhanced-determinism = [ "rapier3d/enhanced-determinism" ]
3232
bevy = { version = "0.8.0", default-features = false, features = ["bevy_asset", "bevy_scene"] }
3333
nalgebra = { version = "^0.31.1", features = [ "convert-glam021" ] }
3434
# Don't enable the default features because we don't need the ColliderSet/RigidBodySet
35-
rapier3d = "0.15.0"
35+
rapier3d = "0.16.0"
3636
bitflags = "1"
3737
#bevy_prototype_debug_lines = { version = "0.6", features = ["3d"], optional = true }
3838
log = "0.4"

src/geometry/collider_impl.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rapier::prelude::{FeatureId, Point, Ray, SharedShape, Vector, DIM};
1111
use super::shape_views::*;
1212
#[cfg(feature = "dim3")]
1313
use crate::geometry::ComputedColliderShape;
14-
use crate::geometry::{Collider, PointProjection, RayIntersection, VHACDParameters};
14+
use crate::geometry::{Collider, PointProjection, RayIntersection, TriMeshFlags, VHACDParameters};
1515
use crate::math::{Real, Rot, Vect};
1616

1717
impl Collider {
@@ -156,16 +156,28 @@ impl Collider {
156156
SharedShape::trimesh(vertices, indices).into()
157157
}
158158

159+
/// Initializes a collider with a triangle mesh shape defined by its vertex and index buffers, and flags
160+
/// controlling its pre-processing.
161+
pub fn trimesh_with_flags(
162+
vertices: Vec<Vect>,
163+
indices: Vec<[u32; 3]>,
164+
flags: TriMeshFlags,
165+
) -> Self {
166+
let vertices = vertices.into_iter().map(|v| v.into()).collect();
167+
SharedShape::trimesh_with_flags(vertices, indices, flags).into()
168+
}
169+
159170
/// Initializes a collider with a Bevy Mesh.
160171
///
161172
/// Returns `None` if the index buffer or vertex buffer of the mesh are in an incompatible format.
162173
#[cfg(feature = "dim3")]
163174
pub fn from_bevy_mesh(mesh: &Mesh, collider_shape: &ComputedColliderShape) -> Option<Self> {
164175
let vertices_indices = extract_mesh_vertices_indices(mesh);
165176
match collider_shape {
166-
ComputedColliderShape::TriMesh => {
167-
vertices_indices.map(|(vtx, idx)| SharedShape::trimesh(vtx, idx).into())
168-
}
177+
ComputedColliderShape::TriMesh => vertices_indices.map(|(vtx, idx)| {
178+
SharedShape::trimesh_with_flags(vtx, idx, TriMeshFlags::MERGE_DUPLICATE_VERTICES)
179+
.into()
180+
}),
169181
ComputedColliderShape::ConvexDecomposition(params) => {
170182
vertices_indices.map(|(vtx, idx)| {
171183
SharedShape::convex_decomposition_with_params(&vtx, &idx, params).into()

src/plugin/context.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use std::collections::HashMap;
33
use std::sync::RwLock;
44

55
use rapier::prelude::{
6-
BroadPhase, CCDSolver, ColliderHandle, ColliderSet, EventHandler, FeatureId,
7-
ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, IslandManager,
6+
Aabb as RapierAabb, BroadPhase, CCDSolver, ColliderHandle, ColliderSet, EventHandler,
7+
FeatureId, ImpulseJointHandle, ImpulseJointSet, IntegrationParameters, IslandManager,
88
MultibodyJointHandle, MultibodyJointSet, NarrowPhase, PhysicsHooks, PhysicsPipeline,
99
QueryFilter as RapierQueryFilter, QueryPipeline, Ray, Real, RigidBodyHandle, RigidBodySet,
10-
AABB,
1110
};
1211

1312
use crate::geometry::{Collider, PointProjection, RayIntersection, Toi};
@@ -708,19 +707,19 @@ impl RapierContext {
708707
})
709708
}
710709

711-
/// Finds all entities of all the colliders with an AABB intersecting the given AABB.
710+
/// Finds all entities of all the colliders with an Aabb intersecting the given Aabb.
712711
pub fn colliders_with_aabb_intersecting_aabb(
713712
&self,
714713
aabb: Aabb,
715714
mut callback: impl FnMut(Entity) -> bool,
716715
) {
717716
#[cfg(feature = "dim2")]
718-
let scaled_aabb = AABB {
717+
let scaled_aabb = RapierAabb {
719718
mins: (aabb.min().xy() / self.physics_scale).into(),
720719
maxs: (aabb.max().xy() / self.physics_scale).into(),
721720
};
722721
#[cfg(feature = "dim3")]
723-
let scaled_aabb = AABB {
722+
let scaled_aabb = RapierAabb {
724723
mins: (aabb.min() / self.physics_scale).into(),
725724
maxs: (aabb.max() / self.physics_scale).into(),
726725
};

src/plugin/narrow_phase.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,12 @@ impl<'a> ContactView<'a> {
222222

223223
/// The feature ID of the first shape involved in the contact.
224224
pub fn fid1(&self) -> u32 {
225-
self.raw.fid1
225+
self.raw.fid1.0
226226
}
227227

228228
/// The feature ID of the second shape involved in the contact.
229229
pub fn fid2(&self) -> u32 {
230-
self.raw.fid2
230+
self.raw.fid2.0
231231
}
232232

233233
/// The impulse, along the contact normal, applied by this contact to the first collider's rigid-body.

0 commit comments

Comments
 (0)