1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
pub use collide::{CollisionMode, CollisionStrategy};
pub use collision::algorithm::minkowski::GJK3;
pub use collision::primitive::{ConvexPolyhedron, Cuboid, Particle3, Sphere};
use std::fmt::Debug;
use cgmath::{Point3, Quaternion, Transform};
use collision::algorithm::broad_phase::BruteForce;
use collision::dbvt::DynamicBoundingVolumeTree;
use collision::primitive::Primitive3;
use specs::{Component, Entity, World};
use {BodyPose, NextFrame, Real};
use collide::*;
use collide::ecs::{BasicCollisionSystem, Contacts, SpatialCollisionSystem, SpatialSortingSystem};
use collide::util::ContainerShapeWrapper;
pub type Contacts3 = Contacts<Point3<Real>>;
pub type CollisionShape3<T> = CollisionShape<Primitive3<Real>, T>;
pub type BroadBruteForce3 = BruteForce;
pub type SweepAndPrune3 = ::collision::algorithm::broad_phase::SweepAndPrune3<Real>;
pub type BasicCollisionSystem3<T> = BasicCollisionSystem<
Primitive3<Real>,
T,
ContainerShapeWrapper<Entity, Primitive3<Real>>,
>;
pub type SpatialSortingSystem3<T> = SpatialSortingSystem<
Primitive3<Real>,
T,
ContainerShapeWrapper<Entity, Primitive3<Real>>,
>;
pub type SpatialCollisionSystem3<T> = SpatialCollisionSystem<
Primitive3<Real>,
T,
(usize, ContainerShapeWrapper<Entity, Primitive3<Real>>),
>;
pub type BodyPose3 = BodyPose<Point3<Real>, Quaternion<Real>>;
pub type DynamicBoundingVolumeTree3 = DynamicBoundingVolumeTree<
ContainerShapeWrapper<Entity, Primitive3<Real>>,
>;
pub fn world_register<'a, T>(world: &mut World)
where
T: Transform<Point3<Real>> + Component + Send + Sync + 'static,
{
world.register::<T>();
world.register::<NextFrame<T>>();
world.register::<CollisionShape3<T>>();
world.add_resource(Contacts3::default());
}
pub fn world_register_with_spatial<T>(mut world: &mut World)
where
T: Transform<Point3<Real>> + Component + Clone + Debug + Send + Sync + 'static,
{
world_register::<T>(&mut world);
world.add_resource(DynamicBoundingVolumeTree3::new());
}