feat: migrate to glam whenever relevant + migrate testbed to kiss3d instead of bevy + release v0.32.0 (#909)
* feat: migrate to glam whenever relevant + migrate testbed to kiss3d instead of bevy * chore: update changelog * Fix warnings and tests * Release v0.32.0
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::utils::character::{self, CharacterControlMode};
|
||||
use kiss3d::color::Color;
|
||||
use rapier_testbed3d::Testbed;
|
||||
use rapier3d::control::{KinematicCharacterController, PidController};
|
||||
use rapier3d::prelude::*;
|
||||
@@ -18,43 +19,43 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
let ground_size = 0.75;
|
||||
let ground_height = 0.1;
|
||||
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]);
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(Vector::new(0.0, -ground_height, 0.0));
|
||||
let floor_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size);
|
||||
colliders.insert_with_parent(collider, floor_handle, &mut bodies);
|
||||
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(vector![
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(Vector::new(
|
||||
-ground_size - ground_height,
|
||||
ground_height,
|
||||
0.0
|
||||
]);
|
||||
0.0,
|
||||
));
|
||||
let floor_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::cuboid(ground_height, ground_height, ground_size);
|
||||
colliders.insert_with_parent(collider, floor_handle, &mut bodies);
|
||||
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(vector![
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(Vector::new(
|
||||
ground_size + ground_height,
|
||||
ground_height,
|
||||
0.0
|
||||
]);
|
||||
0.0,
|
||||
));
|
||||
let floor_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::cuboid(ground_height, ground_height, ground_size);
|
||||
colliders.insert_with_parent(collider, floor_handle, &mut bodies);
|
||||
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(vector![
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(Vector::new(
|
||||
0.0,
|
||||
ground_height,
|
||||
-ground_size - ground_height
|
||||
]);
|
||||
-ground_size - ground_height,
|
||||
));
|
||||
let floor_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_height);
|
||||
colliders.insert_with_parent(collider, floor_handle, &mut bodies);
|
||||
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(vector![
|
||||
let rigid_body = RigidBodyBuilder::fixed().translation(Vector::new(
|
||||
0.0,
|
||||
ground_height,
|
||||
ground_size + ground_height
|
||||
]);
|
||||
ground_size + ground_height,
|
||||
));
|
||||
let floor_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_height);
|
||||
colliders.insert_with_parent(collider, floor_handle, &mut bodies);
|
||||
@@ -64,12 +65,15 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
*/
|
||||
|
||||
let rigid_body =
|
||||
RigidBodyBuilder::kinematic_position_based().translation(vector![0.0, 0.3, 0.0]);
|
||||
RigidBodyBuilder::kinematic_position_based().translation(Vector::new(0.0, 0.3, 0.0));
|
||||
let character_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::cuboid(0.15, 0.3, 0.15);
|
||||
colliders.insert_with_parent(collider, character_handle, &mut bodies);
|
||||
|
||||
testbed.set_initial_body_color(character_handle, [1., 131. / 255., 244.0 / 255.]);
|
||||
testbed.set_initial_body_color(
|
||||
character_handle,
|
||||
Color::new(1., 131. / 255., 244.0 / 255., 1.0),
|
||||
);
|
||||
|
||||
/*
|
||||
* Tethered Ball
|
||||
@@ -77,7 +81,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
let rad = 0.04;
|
||||
|
||||
let rigid_body =
|
||||
RigidBodyBuilder::new(RigidBodyType::Dynamic).translation(vector![1.0, 1.0, 0.0]);
|
||||
RigidBodyBuilder::new(RigidBodyType::Dynamic).translation(Vector::new(1.0, 1.0, 0.0));
|
||||
let child_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::ball(rad);
|
||||
colliders.insert_with_parent(collider, child_handle, &mut bodies);
|
||||
@@ -109,5 +113,5 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
* Set up the testbed.
|
||||
*/
|
||||
testbed.set_world(bodies, colliders, impulse_joints, multibody_joints);
|
||||
testbed.look_at(point![10.0, 10.0, 10.0], point![0.0, 0.0, 0.0]);
|
||||
testbed.look_at(Vec3::new(10.0, 10.0, 10.0), Vec3::new(0.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user