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

Custom changes for godot-rapier #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/dynamics/coefficient_combine_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub enum CoefficientCombineRule {
Min,
/// The two coefficients are multiplied.
Multiply,
/// The sum of the two coefficients.
Sum,
/// The greatest coefficient is chosen.
Max,
}
Expand All @@ -27,8 +29,9 @@ impl CoefficientCombineRule {

match effective_rule {
0 => (coeff1 + coeff2) / 2.0,
1 => coeff1.min(coeff2),
1 => coeff1.min(coeff2).abs(),
2 => coeff1 * coeff2,
3 => (coeff1 + coeff2).clamp(0.0, 1.0),
_ => coeff1.max(coeff2),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/collider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ impl ColliderBuilder {

/// Initializes a collider builder with a triangle mesh shape defined by its vertex and index buffers.
pub fn trimesh(vertices: Vec<Point<Real>>, indices: Vec<[u32; 3]>) -> Self {
Self::new(SharedShape::trimesh(vertices, indices))
Self::new(SharedShape::trimesh(vertices, indices).unwrap())
}

/// Initializes a collider builder with a triangle mesh shape defined by its vertex and index buffers and
Expand All @@ -696,7 +696,7 @@ impl ColliderBuilder {
indices: Vec<[u32; 3]>,
flags: TriMeshFlags,
) -> Self {
Self::new(SharedShape::trimesh_with_flags(vertices, indices, flags))
Self::new(SharedShape::trimesh_with_flags(vertices, indices, flags).unwrap())
}

/// Initializes a collider builder with a shape converted from the given triangle mesh index
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/interaction_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
///
/// In other words, interactions are allowed between two filter iff. the following condition is met:
/// ```ignore
/// (self.memberships & rhs.filter) != 0 && (rhs.memberships & self.filter) != 0
/// (self.memberships & rhs.filter) != 0 || (rhs.memberships & self.filter) != 0
/// ```
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
Expand Down Expand Up @@ -65,7 +65,7 @@ impl InteractionGroups {
// NOTE: since const ops is not stable, we have to convert `Group` into u32
// to use & operator in const context.
(self.memberships.bits() & rhs.filter.bits()) != 0
&& (rhs.memberships.bits() & self.filter.bits()) != 0
|| (rhs.memberships.bits() & self.filter.bits()) != 0
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/geometry/mesh_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ impl MeshConverter {
) -> Result<(SharedShape, Isometry<Real>), MeshConverterError> {
let mut transform = Isometry::identity();
let shape = match self {
MeshConverter::TriMesh => SharedShape::trimesh(vertices, indices),
MeshConverter::TriMesh => SharedShape::trimesh(vertices, indices).unwrap(),
MeshConverter::TriMeshWithFlags(flags) => {
SharedShape::trimesh_with_flags(vertices, indices, *flags)
SharedShape::trimesh_with_flags(vertices, indices, *flags).unwrap()
}
MeshConverter::Obb => {
let (pose, cuboid) = parry::utils::obb(&vertices);
Expand Down
2 changes: 1 addition & 1 deletion src/pipeline/physics_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl PhysicsPipeline {

if let Some(queries) = query_pipeline.as_deref_mut() {
self.counters.stages.query_pipeline_time.start();
queries.update_incremental(colliders, &modified_colliders, &removed_colliders, false);
queries.update_incremental(colliders, &modified_colliders, &removed_colliders, true);
self.counters.stages.query_pipeline_time.pause();
}

Expand Down
Loading