diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-10-26 16:36:07 +0100 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-10-26 16:36:07 +0100 |
| commit | 08930b1238c90bec16db84c50ac4ea7c9a1e0a5b (patch) | |
| tree | dd3baf539e8eabd46dcfcee956d86c0e52a2c10b | |
| parent | ba6655be8e4b781bfaac06282e1c7d53a56111f5 (diff) | |
| download | rapier-08930b1238c90bec16db84c50ac4ea7c9a1e0a5b.tar.gz rapier-08930b1238c90bec16db84c50ac4ea7c9a1e0a5b.tar.bz2 rapier-08930b1238c90bec16db84c50ac4ea7c9a1e0a5b.zip | |
Fix multiple warnings.
| -rw-r--r-- | examples3d/debug_cylinder3.rs | 4 | ||||
| -rw-r--r-- | examples3d/primitives3.rs | 2 | ||||
| -rw-r--r-- | src/dynamics/mass_properties_capsule.rs | 4 | ||||
| -rw-r--r-- | src/dynamics/mass_properties_cone.rs | 1 | ||||
| -rw-r--r-- | src/dynamics/mass_properties_cylinder.rs | 7 | ||||
| -rw-r--r-- | src/geometry/collider.rs | 2 | ||||
| -rw-r--r-- | src/geometry/contact_generator/heightfield_shape_contact_generator.rs | 4 | ||||
| -rw-r--r-- | src/geometry/contact_generator/pfm_pfm_contact_generator.rs | 7 | ||||
| -rw-r--r-- | src/geometry/contact_generator/polygon_polygon_contact_generator.rs | 2 | ||||
| -rw-r--r-- | src/geometry/polygon.rs | 2 | ||||
| -rw-r--r-- | src/geometry/proximity_detector/polygon_polygon_proximity_detector.rs | 2 | ||||
| -rw-r--r-- | src/geometry/sat.rs | 1 | ||||
| -rw-r--r-- | src/utils.rs | 26 | ||||
| -rw-r--r-- | src_testbed/box2d_backend.rs | 2 | ||||
| -rw-r--r-- | src_testbed/nphysics_backend.rs | 2 | ||||
| -rw-r--r-- | src_testbed/physx_backend.rs | 2 | ||||
| -rw-r--r-- | src_testbed/testbed.rs | 4 |
17 files changed, 23 insertions, 51 deletions
diff --git a/examples3d/debug_cylinder3.rs b/examples3d/debug_cylinder3.rs index 4e7fae1..0717c67 100644 --- a/examples3d/debug_cylinder3.rs +++ b/examples3d/debug_cylinder3.rs @@ -1,4 +1,4 @@ -use na::{Point3, Vector3}; +use na::Point3; use rapier3d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet}; use rapier3d::geometry::{ColliderBuilder, ColliderSet}; use rapier_testbed3d::Testbed; @@ -40,7 +40,7 @@ pub fn init_world(testbed: &mut Testbed) { let centery = shifty / 2.0; let centerz = shiftz * (num / 2) as f32; - let mut offset = -(num as f32) * (rad * 2.0 + rad) * 0.5; + let offset = -(num as f32) * (rad * 2.0 + rad) * 0.5; let x = -centerx + offset; let y = centery + 3.0; diff --git a/examples3d/primitives3.rs b/examples3d/primitives3.rs index 6a98077..db15341 100644 --- a/examples3d/primitives3.rs +++ b/examples3d/primitives3.rs @@ -1,4 +1,4 @@ -use na::{Point3, Vector3}; +use na::Point3; use rapier3d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet}; use rapier3d::geometry::{ColliderBuilder, ColliderSet}; use rapier_testbed3d::Testbed; diff --git a/src/dynamics/mass_properties_capsule.rs b/src/dynamics/mass_properties_capsule.rs index dae6cfb..3b1b214 100644 --- a/src/dynamics/mass_properties_capsule.rs +++ b/src/dynamics/mass_properties_capsule.rs @@ -1,7 +1,7 @@ use crate::dynamics::MassProperties; -use crate::math::Point; #[cfg(feature = "dim3")] -use crate::{geometry::Capsule, math::Rotation}; +use crate::geometry::Capsule; +use crate::math::Point; impl MassProperties { pub(crate) fn from_capsule(density: f32, a: Point<f32>, b: Point<f32>, radius: f32) -> Self { diff --git a/src/dynamics/mass_properties_cone.rs b/src/dynamics/mass_properties_cone.rs index 0fb61b6..12f831f 100644 --- a/src/dynamics/mass_properties_cone.rs +++ b/src/dynamics/mass_properties_cone.rs @@ -1,5 +1,4 @@ use crate::dynamics::MassProperties; -use crate::geometry::Cone; use crate::math::{Point, PrincipalAngularInertia, Rotation, Vector}; impl MassProperties { diff --git a/src/dynamics/mass_properties_cylinder.rs b/src/dynamics/mass_properties_cylinder.rs index 8d4f254..7c8054a 100644 --- a/src/dynamics/mass_properties_cylinder.rs +++ b/src/dynamics/mass_properties_cylinder.rs @@ -1,10 +1,7 @@ use crate::dynamics::MassProperties; -use crate::math::{PrincipalAngularInertia, Vector}; #[cfg(feature = "dim3")] -use { - crate::geometry::Capsule, - crate::math::{Point, Rotation}, -}; +use crate::math::{Point, Rotation}; +use crate::math::{PrincipalAngularInertia, Vector}; impl MassProperties { pub(crate) fn cylinder_y_volume_unit_inertia( diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index ae5cc73..d4f685c 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -4,7 +4,7 @@ use crate::geometry::{ Segment, Shape, ShapeType, Triangle, Trimesh, }; #[cfg(feature = "dim3")] -use crate::geometry::{Cone, Cylinder, PolygonalFeatureMap, Rounded}; +use crate::geometry::{Cone, Cylinder, Rounded}; use crate::math::{AngVector, Isometry, Point, Rotation, Vector}; use na::Point3; use ncollide::bounding_volume::AABB; diff --git a/src/geometry/contact_generator/heightfield_shape_contact_generator.rs b/src/geometry/contact_generator/heightfield_shape_contact_generator.rs index 81752e4..9224d4e 100644 --- a/src/geometry/contact_generator/heightfield_shape_contact_generator.rs +++ b/src/geometry/contact_generator/heightfield_shape_contact_generator.rs @@ -5,8 +5,6 @@ use crate::geometry::contact_generator::{ use crate::geometry::Capsule; use crate::geometry::{Collider, ContactManifold, HeightField, Shape, ShapeType}; use crate::ncollide::bounding_volume::BoundingVolume; -#[cfg(feature = "dim3")] -use crate::{geometry::Triangle, math::Point}; use std::any::Any; use std::collections::hash_map::Entry; use std::collections::HashMap; @@ -111,7 +109,7 @@ fn do_generate_contacts( heightfield1.map_elements_in_local_aabb(&ls_aabb2, &mut |i, part1, _| { let position1 = collider1.position(); #[cfg(feature = "dim2")] - let sub_shape1 = Capsule::new(part1.a, part1.b, 0.0); + let sub_shape1 = Capsule::new(part1.a, part1.b, 0.0); // TODO: use a segment instead. #[cfg(feature = "dim3")] let sub_shape1 = *part1; diff --git a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs index 37f8629..62a38ae 100644 --- a/src/geometry/contact_generator/pfm_pfm_contact_generator.rs +++ b/src/geometry/contact_generator/pfm_pfm_contact_generator.rs @@ -1,9 +1,6 @@ use crate::geometry::contact_generator::PrimitiveContactGenerationContext; -use crate::geometry::{ - Contact, ContactManifold, KinematicsCategory, PolygonalFeatureMap, PolyhedronFace, -}; +use crate::geometry::{KinematicsCategory, PolygonalFeatureMap, PolyhedronFace}; use crate::math::{Isometry, Vector}; -use crate::na::UnitQuaternion; use na::Unit; use ncollide::query; use ncollide::query::algorithms::{gjk::GJKResult, VoronoiSimplex}; @@ -11,7 +8,6 @@ use ncollide::query::algorithms::{gjk::GJKResult, VoronoiSimplex}; pub struct PfmPfmContactManifoldGeneratorWorkspace { simplex: VoronoiSimplex<f32>, last_gjk_dir: Option<Unit<Vector<f32>>>, - last_optimal_dir: Option<Unit<Vector<f32>>>, feature1: PolyhedronFace, feature2: PolyhedronFace, } @@ -21,7 +17,6 @@ impl Default for PfmPfmContactManifoldGeneratorWorkspace { Self { simplex: VoronoiSimplex::new(), last_gjk_dir: None, - last_optimal_dir: None, feature1: PolyhedronFace::new(), feature2: PolyhedronFace::new(), } diff --git a/src/geometry/contact_generator/polygon_polygon_contact_generator.rs b/src/geometry/contact_generator/polygon_polygon_contact_generator.rs index e1e6e7e..0e7543d 100644 --- a/src/geometry/contact_generator/polygon_polygon_contact_generator.rs +++ b/src/geometry/contact_generator/polygon_polygon_contact_generator.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] // TODO: remove this once we support polygons. + use crate::geometry::contact_generator::PrimitiveContactGenerationContext; use crate::geometry::{sat, Contact, ContactManifold, KinematicsCategory, Polygon}; use crate::math::{Isometry, Point}; diff --git a/src/geometry/polygon.rs b/src/geometry/polygon.rs index cdb1012..d07cfd9 100644 --- a/src/geometry/polygon.rs +++ b/src/geometry/polygon.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] // TODO: remove this once we support polygons. + use crate::math::{Isometry, Point, Vector}; use ncollide::bounding_volume::AABB; diff --git a/src/geometry/proximity_detector/polygon_polygon_proximity_detector.rs b/src/geometry/proximity_detector/polygon_polygon_proximity_detector.rs index 30a02fa..12a8e45 100644 --- a/src/geometry/proximity_detector/polygon_polygon_proximity_detector.rs +++ b/src/geometry/proximity_detector/polygon_polygon_proximity_detector.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use crate::geometry::proximity_detector::PrimitiveProximityDetectionContext; use crate::geometry::{sat, Polygon, Proximity}; use crate::math::Isometry; diff --git a/src/geometry/sat.rs b/src/geometry/sat.rs index e2548dd..452b380 100644 --- a/src/geometry/sat.rs +++ b/src/geometry/sat.rs @@ -4,6 +4,7 @@ use crate::utils::WSign; use na::Unit; use ncollide::shape::{Segment, SupportMap}; +#[allow(dead_code)] pub fn polygon_polygon_compute_separation_features( p1: &Polygon, p2: &Polygon, diff --git a/src/utils.rs b/src/utils.rs index 0bc9e17..a398a02 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,6 @@ //! Miscellaneous utilities. use crate::dynamics::RigidBodyHandle; -use crate::math::{Isometry, Point, Rotation, Vector}; #[cfg(all(feature = "enhanced-determinism", feature = "serde-serialize"))] use indexmap::IndexMap as HashMap; use na::{Matrix2, Matrix3, Matrix3x2, Point2, Point3, Scalar, SimdRealField, Vector2, Vector3}; @@ -1334,28 +1333,3 @@ pub(crate) fn other_handle( pair.0 } } - -/// Returns the rotation that aligns the y axis to the segment direction. -pub(crate) fn rotation_wrt_y(a: &Point<f32>, b: &Point<f32>) -> Rotation<f32> { - let mut dir = b - a; - - if dir.y < 0.0 { - dir = -dir; - } - - #[cfg(feature = "dim2")] - return Rotation::rotation_between(&Vector::y(), &dir); - - #[cfg(feature = "dim3")] - return Rotation::rotation_between(&Vector::y(), &dir).unwrap_or(Rotation::identity()); -} - -// Return the transform that aligns the y axis to the segment and move the origin to the segment middle, -// and the capsule's half-height. -pub(crate) fn segment_to_capsule(a: &Point<f32>, b: &Point<f32>) -> (Isometry<f32>, f32) { - let rot = rotation_wrt_y(a, b); - let half_height = (b - a).norm() / 2.0; - let center = na::center(a, b); - let pos = Isometry::from_parts(center.coords.into(), rot); - (pos, half_height) -} diff --git a/src_testbed/box2d_backend.rs b/src_testbed/box2d_backend.rs index 9156c2a..769b12d 100644 --- a/src_testbed/box2d_backend.rs +++ b/src_testbed/box2d_backend.rs @@ -5,7 +5,7 @@ use rapier::counters::Counters; use rapier::dynamics::{ IntegrationParameters, JointParams, JointSet, RigidBodyHandle, RigidBodySet, }; -use rapier::geometry::{Collider, ColliderSet, Shape}; +use rapier::geometry::{Collider, ColliderSet}; use std::f32; use wrapped2d::b2; diff --git a/src_testbed/nphysics_backend.rs b/src_testbed/nphysics_backend.rs index a2b0331..3a0e487 100644 --- a/src_testbed/nphysics_backend.rs +++ b/src_testbed/nphysics_backend.rs @@ -12,7 +12,7 @@ use rapier::counters::Counters; use rapier::dynamics::{ IntegrationParameters, JointParams, JointSet, RigidBodyHandle, RigidBodySet, }; -use rapier::geometry::{Collider, ColliderSet, Shape}; +use rapier::geometry::{Collider, ColliderSet}; use rapier::math::Vector; use std::collections::HashMap; #[cfg(feature = "dim3")] diff --git a/src_testbed/physx_backend.rs b/src_testbed/physx_backend.rs index 7db3c4c..74d6af2 100644 --- a/src_testbed/physx_backend.rs +++ b/src_testbed/physx_backend.rs @@ -6,7 +6,7 @@ use rapier::counters::Counters; use rapier::dynamics::{ IntegrationParameters, JointParams, JointSet, RigidBodyHandle, RigidBodySet, }; -use rapier::geometry::{Collider, ColliderSet, Shape}; +use rapier::geometry::{Collider, ColliderSet}; use rapier::utils::WBasis; use std::collections::HashMap; diff --git a/src_testbed/testbed.rs b/src_testbed/testbed.rs index 3d7fd7d..2b733a3 100644 --- a/src_testbed/testbed.rs +++ b/src_testbed/testbed.rs @@ -21,7 +21,9 @@ use na::{self, Point2, Point3, Vector3}; use rapier::dynamics::{ ActivationStatus, IntegrationParameters, JointSet, RigidBodyHandle, RigidBodySet, }; -use rapier::geometry::{BroadPhase, ColliderSet, ContactEvent, NarrowPhase, ProximityEvent, Ray}; +#[cfg(feature = "dim3")] +use rapier::geometry::Ray; +use rapier::geometry::{BroadPhase, ColliderSet, ContactEvent, NarrowPhase, ProximityEvent}; use rapier::math::Vector; use rapier::pipeline::{ChannelEventCollector, PhysicsPipeline, QueryPipeline}; #[cfg(feature = "fluids")] |
