aboutsummaryrefslogtreecommitdiff
path: root/examples2d/ccd2.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-03-19 17:52:56 +0100
committerSébastien Crozet <sebastien@crozet.re>2022-03-20 21:49:16 +0100
commit063c638ec5906747e3ca85ee0c5f112c7775f797 (patch)
tree498090f01c8cf8d69a35d03e123a1dfe006c54bf /examples2d/ccd2.rs
parenta9e3441ecd64d50b478ab5370fabe187ec9a5c39 (diff)
downloadrapier-063c638ec5906747e3ca85ee0c5f112c7775f797.tar.gz
rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.tar.bz2
rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.zip
Combine contact events and intersection events into a single event type and flags
Diffstat (limited to 'examples2d/ccd2.rs')
-rw-r--r--examples2d/ccd2.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples2d/ccd2.rs b/examples2d/ccd2.rs
index 0a10800..4844579 100644
--- a/examples2d/ccd2.rs
+++ b/examples2d/ccd2.rs
@@ -33,7 +33,7 @@ pub fn init_world(testbed: &mut Testbed) {
let collider = ColliderBuilder::cuboid(ground_thickness, ground_size)
.translation(vector![2.5, 0.0])
.sensor(true)
- .active_events(ActiveEvents::INTERSECTION_EVENTS);
+ .active_events(ActiveEvents::COLLISION_EVENTS);
let sensor_handle = colliders.insert_with_parent(collider, ground_handle, &mut bodies);
/*
@@ -87,8 +87,8 @@ pub fn init_world(testbed: &mut Testbed) {
// Callback that will be executed on the main loop to handle proximities.
testbed.add_callback(move |mut graphics, physics, events, _| {
- while let Ok(prox) = events.intersection_events.try_recv() {
- let color = if prox.intersecting {
+ while let Ok(prox) = events.events.try_recv() {
+ let color = if prox.started() {
[1.0, 1.0, 0.0]
} else {
[0.5, 0.5, 1.0]
@@ -96,22 +96,22 @@ pub fn init_world(testbed: &mut Testbed) {
let parent_handle1 = physics
.colliders
- .get(prox.collider1)
+ .get(prox.collider1())
.unwrap()
.parent()
.unwrap();
let parent_handle2 = physics
.colliders
- .get(prox.collider2)
+ .get(prox.collider2())
.unwrap()
.parent()
.unwrap();
if let Some(graphics) = &mut graphics {
- if parent_handle1 != ground_handle && prox.collider1 != sensor_handle {
+ if parent_handle1 != ground_handle && prox.collider1() != sensor_handle {
graphics.set_body_color(parent_handle1, color);
}
- if parent_handle2 != ground_handle && prox.collider2 != sensor_handle {
+ if parent_handle2 != ground_handle && prox.collider2() != sensor_handle {
graphics.set_body_color(parent_handle2, color);
}
}