From ef817389f373f414fecf4a2f558e1dc9007d8de6 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 17 Nov 2023 14:10:42 -0800 Subject: [PATCH] hit_the_ground unit test --- src/physics.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/physics.rs b/src/physics.rs index d8baefa..1693b9c 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -1616,3 +1616,21 @@ impl crate::instruction::InstructionConsumer for PhysicsStat } } } + +#[test] +fn hit_the_ground(){ + let h0=Hitbox::roblox(); + let h1=Hitbox::roblox(); + let mesh0=h0.transformed_mesh(); + let mesh1=h1.transformed_mesh(); + let relative_body=Body::new( + Planar64Vec3::Y*10, + Planar64Vec3::int(1,-160,2)/16, + Planar64Vec3::ZERO, + Time::ZERO + ); + let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&mesh0,&mesh1); + let collision=minkowski.predict_collision_in(&relative_body,Time::ONE_SECOND); + assert!(collision.is_some(),"No collision was generated"); + assert_eq!(Time::ONE_SECOND/2,collision.unwrap().1,"Incorrect time of collision"); +} \ No newline at end of file