Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d2c9c35
update to bevy 0.14 + add some control for testbed character controller
ThierryBerger Jul 24, 2024
5a03a09
adapt example + add simpler test to reproduce max slope bug
ThierryBerger Jul 25, 2024
63233f6
fix character controller max slope + add tests + better testbed setup
ThierryBerger Jul 25, 2024
222c2ec
Update src/control/character_controller.rs
ThierryBerger Jul 25, 2024
64c810e
fix some clippy warnings + better fix for grounded status
ThierryBerger Jul 26, 2024
175316b
Merge branch 'testbed_character_controller' of github.com:Vrixyz/rapi…
ThierryBerger Jul 26, 2024
2a04835
reinstate nudge factor
ThierryBerger Jul 29, 2024
e4c923e
more margin for impossible slope example + as much possible reuse ini…
ThierryBerger Jul 30, 2024
c1fe32b
lower nudge factor to avoid messing too much with ground detection
ThierryBerger Jul 30, 2024
9862850
slightly better comments
ThierryBerger Jul 30, 2024
a9c5b68
revert ground change + better ci test
ThierryBerger Jul 30, 2024
7204849
remove unused comments + spaces polish
ThierryBerger Jul 30, 2024
bccd234
polish testbec character ui
ThierryBerger Jul 30, 2024
8cdb21a
fmt
ThierryBerger Jul 30, 2024
c6b359d
Merge remote-tracking branch 'upstream' into testbed_character_contro…
ThierryBerger Aug 5, 2024
0bd887b
fix clippy
ThierryBerger Aug 5, 2024
553d164
fix test f64 warnings
ThierryBerger Aug 9, 2024
160fbb3
fix other warnings
ThierryBerger Aug 9, 2024
c6420f6
Merge remote-tracking branch 'upstream' into testbed_character_contro…
ThierryBerger Sep 9, 2024
677ed84
Merge branch 'master' into testbed_character_controller
ThierryBerger Sep 23, 2024
98b58e6
update changelog
ThierryBerger Sep 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/rapier_testbed2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ other-backends = ["wrapped2d"]
features = ["parallel", "other-backends"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
Expand Down
16 changes: 8 additions & 8 deletions crates/rapier_testbed2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ other-backends = ["wrapped2d"]
features = ["parallel", "other-backends"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
Expand All @@ -46,16 +46,16 @@ bincode = "1"
Inflector = "0.11"
md5 = "0.7"

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.28"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = "0.7"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_sprite",
"bevy_winit",
"x11",
Expand All @@ -69,7 +69,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_sprite",
"bevy_winit",
"tonemapping_luts",
Expand Down
14 changes: 7 additions & 7 deletions crates/rapier_testbed3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = ["derive"] }

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.28"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = { version = "0.7", features = [ "3d" ] }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"x11",
"tonemapping_luts",
Expand All @@ -67,7 +67,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"tonemapping_luts",
"ktx2",
Expand Down
18 changes: 9 additions & 9 deletions crates/rapier_testbed3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ other-backends = ["physx", "physx-sys", "glam"]
features = ["parallel", "other-backends"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
bitflags = "2"
glam = { version = "0.24", optional = true } # For Physx
glam = { version = "0.27", optional = true } # For Physx
num_cpus = { version = "1", optional = true }
physx = { version = "0.19", features = ["glam"], optional = true }
physx-sys = { version = "0.11", optional = true }
Expand All @@ -49,16 +49,16 @@ md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = ["derive"] }

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.28"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = { version = "0.7", features = [ "3d" ] }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"x11",
"tonemapping_luts",
Expand All @@ -71,7 +71,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"tonemapping_luts",
"ktx2",
Expand Down
25 changes: 13 additions & 12 deletions examples3d/character_controller3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rapier3d::prelude::*;
use rapier3d::{control::KinematicCharacterController, prelude::*};
use rapier_testbed3d::Testbed;

pub fn init_world(testbed: &mut Testbed) {
Expand Down Expand Up @@ -41,7 +41,7 @@ pub fn init_world(testbed: &mut Testbed) {
* Character we will control manually.
*/
let rigid_body =
RigidBodyBuilder::kinematic_position_based().translation(vector![-3.0, 5.0, 0.0] * scale);
RigidBodyBuilder::kinematic_position_based().translation(vector![0.0, 0.5, 0.0] * scale);
let character_handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::capsule_y(0.3 * scale, 0.15 * scale); // 0.15, 0.3, 0.15);
colliders.insert_with_parent(collider, character_handle, &mut bodies);
Expand Down Expand Up @@ -94,19 +94,15 @@ pub fn init_world(testbed: &mut Testbed) {
*/
let slope_angle = 0.2;
let slope_size = 2.0;
let collider = ColliderBuilder::cuboid(
slope_size * scale,
ground_height * scale,
slope_size * scale,
)
.translation(vector![ground_size + slope_size, -ground_height + 0.4, 0.0] * scale)
.rotation(Vector::z() * slope_angle);
let collider = ColliderBuilder::cuboid(slope_size, ground_height, slope_size)
.translation(vector![0.1 + slope_size, -ground_height + 0.4, 0.0])
.rotation(Vector::z() * slope_angle);
Comment on lines -103 to +100

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scale to add back ; not sure it's still usable though 🤔

colliders.insert(collider);

/*
* Create a slope we can’t climb.
*/
let impossible_slope_angle = 0.9;
let impossible_slope_angle = 0.6;
let impossible_slope_size = 2.0;
let collider = ColliderBuilder::cuboid(
slope_size * scale,
Expand All @@ -115,8 +111,8 @@ pub fn init_world(testbed: &mut Testbed) {
)
.translation(
vector![
ground_size + slope_size * 2.0 + impossible_slope_size - 0.9,
-ground_height + 2.3,
0.1 + slope_size * 2.0 + impossible_slope_size - 0.9,
-ground_height + 1.7,
Comment thread
ThierryBerger marked this conversation as resolved.
0.0
] * scale,
)
Expand Down Expand Up @@ -184,5 +180,10 @@ pub fn init_world(testbed: &mut Testbed) {
*/
testbed.set_world(bodies, colliders, impulse_joints, multibody_joints);
testbed.set_character_body(character_handle);
testbed.set_character_controller(Some(KinematicCharacterController {
max_slope_climb_angle: impossible_slope_angle - 0.001,
slide: true,
..Default::default()
}));
testbed.look_at(point!(10.0, 10.0, 10.0), Point::origin());
}
2 changes: 1 addition & 1 deletion examples3d/debug_internal_edges3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn init_world(testbed: &mut Testbed) {
colliders.insert_with_parent(collider, handle, &mut bodies);

let rigid_body = RigidBodyBuilder::dynamic()
.translation(vector![0.0, 0.5, 0.0])
.translation(vector![-3.0, 5.0, 0.0])
.linvel(vector![0.0, -4.0, 20.0])
.can_sleep(false);
let handle = bodies.insert(rigid_body);
Expand Down
Loading