aboutsummaryrefslogtreecommitdiff
path: root/examples2d
diff options
context:
space:
mode:
Diffstat (limited to 'examples2d')
-rw-r--r--examples2d/character_controller2.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples2d/character_controller2.rs b/examples2d/character_controller2.rs
index ff500e9..8ecd23c 100644
--- a/examples2d/character_controller2.rs
+++ b/examples2d/character_controller2.rs
@@ -1,5 +1,6 @@
use rapier2d::prelude::*;
use rapier_testbed2d::Testbed;
+use std::f32::consts::PI;
pub fn init_world(testbed: &mut Testbed) {
/*
@@ -89,6 +90,19 @@ pub fn init_world(testbed: &mut Testbed) {
colliders.insert(collider);
/*
+ * Create a wall we can’t climb.
+ */
+ let wall_angle = PI / 2.;
+ let wall_size = 2.0;
+ let collider = ColliderBuilder::cuboid(wall_size, ground_height)
+ .translation(vector![
+ ground_size + slope_size * 2.0 + impossible_slope_size + 0.35,
+ -ground_height + 2.5 * 2.3
+ ])
+ .rotation(wall_angle);
+ colliders.insert(collider);
+
+ /*
* Create a moving platform.
*/
let body = RigidBodyBuilder::kinematic_velocity_based().translation(vector![-8.0, 1.5]);