Add compound shape support.

This commit is contained in:
Crozet Sébastien
2021-01-05 15:34:48 +01:00
parent 6ba5081358
commit 00da4aaa42
10 changed files with 123 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window;
use na::Point3;
use na::{Isometry3, Point3};
use rapier::geometry::{self, ColliderHandle, ColliderSet};
use rapier::math::Isometry;
@@ -9,11 +9,13 @@ pub struct Capsule {
base_color: Point3<f32>,
gfx: GraphicsNode,
collider: ColliderHandle,
delta: Isometry3<f32>,
}
impl Capsule {
pub fn new(
collider: ColliderHandle,
delta: Isometry3<f32>,
capsule: &geometry::Capsule,
color: Point3<f32>,
window: &mut window::Window,
@@ -30,6 +32,7 @@ impl Capsule {
base_color: color,
gfx: node,
collider,
delta,
};
res.gfx.set_color(color.x, color.y, color.z);
@@ -50,7 +53,7 @@ impl Capsule {
colliders,
self.collider,
&self.color,
&Isometry::identity(),
&self.delta,
);
}