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:
@@ -19,7 +19,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
let ground_size = 3.0;
|
||||
let ground_height = 0.1;
|
||||
|
||||
let rigid_body_floor = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height]);
|
||||
let rigid_body_floor = RigidBodyBuilder::fixed().translation(Vector::new(0.0, -ground_height));
|
||||
let floor_handle = bodies.insert(rigid_body_floor);
|
||||
let floor_collider = ColliderBuilder::cuboid(ground_size, ground_height);
|
||||
colliders.insert_with_parent(floor_collider, floor_handle, &mut bodies);
|
||||
@@ -28,7 +28,7 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
* Character we will control manually.
|
||||
*/
|
||||
let rigid_body_character =
|
||||
RigidBodyBuilder::kinematic_position_based().translation(vector![0.0, 0.3]);
|
||||
RigidBodyBuilder::kinematic_position_based().translation(Vector::new(0.0, 0.3));
|
||||
let character_handle = bodies.insert(rigid_body_character);
|
||||
let character_collider = ColliderBuilder::cuboid(0.15, 0.3);
|
||||
colliders.insert_with_parent(character_collider, character_handle, &mut bodies);
|
||||
@@ -39,16 +39,16 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
let rad = 0.4;
|
||||
|
||||
let rigid_body_cube =
|
||||
RigidBodyBuilder::new(RigidBodyType::Dynamic).translation(vector![1.0, 1.0]);
|
||||
RigidBodyBuilder::new(RigidBodyType::Dynamic).translation(Vector::new(1.0, 1.0));
|
||||
let cube_handle = bodies.insert(rigid_body_cube);
|
||||
let cube_collider = ColliderBuilder::cuboid(rad, rad);
|
||||
colliders.insert_with_parent(cube_collider, cube_handle, &mut bodies);
|
||||
|
||||
/*
|
||||
* Rotation axis indicator ball.
|
||||
* SimdRotation axis indicator ball.
|
||||
*/
|
||||
let rigid_body_ball =
|
||||
RigidBodyBuilder::new(RigidBodyType::Dynamic).translation(vector![1.0, 1.0]);
|
||||
RigidBodyBuilder::new(RigidBodyType::Dynamic).translation(Vector::new(1.0, 1.0));
|
||||
let ball_handle = bodies.insert(rigid_body_ball);
|
||||
let ball_collider = ColliderBuilder::ball(0.1);
|
||||
colliders.insert_with_parent(ball_collider, ball_handle, &mut bodies);
|
||||
@@ -57,25 +57,18 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
* Fixed joint between rotation axis indicator and cube.
|
||||
*/
|
||||
let fixed_joint = FixedJointBuilder::new()
|
||||
.local_anchor1(point![0.0, 0.0])
|
||||
.local_anchor2(point![0.0, -0.4])
|
||||
.local_anchor1(Vector::new(0.0, 0.0))
|
||||
.local_anchor2(Vector::new(0.0, -0.4))
|
||||
.build();
|
||||
impulse_joints.insert(cube_handle, ball_handle, fixed_joint, true);
|
||||
|
||||
/*
|
||||
* Pin slot joint between cube and ground.
|
||||
*/
|
||||
let axis: nalgebra::Unit<
|
||||
nalgebra::Matrix<
|
||||
f32,
|
||||
nalgebra::Const<2>,
|
||||
nalgebra::Const<1>,
|
||||
nalgebra::ArrayStorage<f32, 2, 1>,
|
||||
>,
|
||||
> = UnitVector::new_normalize(vector![1.0, 1.0]);
|
||||
let axis = Vector::new(1.0, 1.0).normalize();
|
||||
let pin_slot_joint = PinSlotJointBuilder::new(axis)
|
||||
.local_anchor1(point![2.0, 2.0])
|
||||
.local_anchor2(point![0.0, 0.4])
|
||||
.local_anchor1(Vector::new(2.0, 2.0))
|
||||
.local_anchor2(Vector::new(0.0, 0.4))
|
||||
.limits([-1.0, f32::INFINITY]) // Set the limits for the pin slot joint
|
||||
.build();
|
||||
impulse_joints.insert(character_handle, cube_handle, pin_slot_joint, true);
|
||||
@@ -104,5 +97,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![0.0, 1.0], 100.0);
|
||||
testbed.look_at(Vec2::new(0.0, 1.0), 100.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user