aboutsummaryrefslogtreecommitdiff
path: root/examples2d/sensor2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples2d/sensor2.rs')
-rw-r--r--examples2d/sensor2.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/examples2d/sensor2.rs b/examples2d/sensor2.rs
index e53abe3..a651f64 100644
--- a/examples2d/sensor2.rs
+++ b/examples2d/sensor2.rs
@@ -43,7 +43,7 @@ pub fn init_world(testbed: &mut Testbed) {
let collider = ColliderBuilder::cuboid(rad, rad).build();
colliders.insert(collider, handle, &mut bodies);
- testbed.set_body_color(handle, Point3::new(0.5, 0.5, 1.0));
+ testbed.set_initial_body_color(handle, Point3::new(0.5, 0.5, 1.0));
}
/*
@@ -66,10 +66,10 @@ pub fn init_world(testbed: &mut Testbed) {
let sensor_collider = ColliderBuilder::ball(rad * 5.0).sensor(true).build();
colliders.insert(sensor_collider, sensor_handle, &mut bodies);
- testbed.set_body_color(sensor_handle, Point3::new(0.5, 1.0, 1.0));
+ testbed.set_initial_body_color(sensor_handle, Point3::new(0.5, 1.0, 1.0));
// Callback that will be executed on the main loop to handle proximities.
- testbed.add_callback(move |_, mut graphics, physics, events, _| {
+ testbed.add_callback(move |mut graphics, physics, events, _| {
while let Ok(prox) = events.intersection_events.try_recv() {
let color = if prox.intersecting {
Point3::new(1.0, 1.0, 0.0)
@@ -96,8 +96,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point2::new(0.0, 1.0), 100.0);
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Sensor", init_world)]);
- testbed.run()
-}