Fix compilation in 2D.

This commit is contained in:
Crozet Sébastien
2020-10-06 15:49:22 +02:00
parent c5a8e03df7
commit e87b73a2a2
8 changed files with 32 additions and 34 deletions

View File

@@ -124,7 +124,7 @@ impl Shape {
}
Shape::Cuboid(cuboid) => cuboid.toi_and_normal_with_ray(position, ray, max_toi, true),
#[cfg(feature = "dim2")]
Shape::Triangle(triangle) => {
Shape::Triangle(_) | Shape::Trimesh(_) => {
// This is not implemented yet in 2D.
None
}
@@ -132,6 +132,7 @@ impl Shape {
Shape::Triangle(triangle) => {
triangle.toi_and_normal_with_ray(position, ray, max_toi, true)
}
#[cfg(feature = "dim3")]
Shape::Trimesh(trimesh) => {
trimesh.toi_and_normal_with_ray(position, ray, max_toi, true)
}

View File

@@ -1,9 +1,14 @@
use crate::geometry::{Ray, RayIntersection, Triangle, WQuadtree};
use crate::geometry::{Triangle, WQuadtree};
use crate::math::{Isometry, Point};
use crate::ncollide::query::RayCast;
use na::Point3;
use ncollide::bounding_volume::{HasBoundingVolume, AABB};
#[cfg(feature = "dim3")]
use {
crate::geometry::{Ray, RayIntersection},
ncollide::query::RayCast,
};
#[derive(Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
/// A triangle mesh.
@@ -105,6 +110,7 @@ impl Trimesh {
}
}
#[cfg(feature = "dim3")]
impl RayCast<f32> for Trimesh {
fn toi_and_normal_with_ray(
&self,

View File

@@ -1,6 +1,8 @@
use crate::geometry::{ColliderHandle, ColliderSet, Ray, AABB};
use crate::geometry::{WRay, WAABB};
use crate::math::{Point, Vector};
use crate::math::Point;
#[cfg(feature = "dim3")]
use crate::math::Vector;
use crate::simd::{SimdFloat, SIMD_WIDTH};
use ncollide::bounding_volume::BoundingVolume;
use simba::simd::{SimdBool, SimdValue};
@@ -252,6 +254,7 @@ impl<T: IndexedData> WQuadtree<T> {
// Find the axis with minimum variance. This is the axis along
// which we are **not** subdividing our set.
#[allow(unused_mut)] // Does not need to be mutable in 2D.
let mut subdiv_dims = [0, 1];
#[cfg(feature = "dim3")]
{
@@ -466,6 +469,7 @@ impl<T: IndexedData> WQuadtreeIncrementalBuilder<T> {
// Find the axis with minimum variance. This is the axis along
// which we are **not** subdividing our set.
#[allow(unused_mut)] // Does not need to be mutable in 2D.
let mut subdiv_dims = [0, 1];
#[cfg(feature = "dim3")]
{

View File

@@ -58,18 +58,6 @@ impl PhysicsPipeline {
}
}
/// Remove this.
pub fn maintain(
&mut self,
broad_phase: &mut BroadPhase,
narrow_phase: &mut NarrowPhase,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
) {
broad_phase.maintain(colliders);
narrow_phase.maintain(colliders, bodies);
}
/// Executes one timestep of the physics simulation.
pub fn step(
&mut self,
@@ -82,9 +70,9 @@ impl PhysicsPipeline {
joints: &mut JointSet,
events: &dyn EventHandler,
) {
// println!("Step");
self.counters.step_started();
self.maintain(broad_phase, narrow_phase, bodies, colliders);
broad_phase.maintain(colliders);
narrow_phase.maintain(colliders, bodies);
bodies.maintain_active_set();
// Update kinematic bodies velocities.