From 9de6fe85fa13f1e345008bee647b677e97a16afc Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 29 Nov 2023 19:11:43 -0800 Subject: [PATCH] test more things --- src/physics.rs | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 744c981..e6ce316 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -345,6 +345,20 @@ struct Hitbox{ normal_transform:Planar64Mat3, } impl Hitbox{ + fn new(mesh:PhysicsMesh,transform:crate::integer::Planar64Affine3)->Self{ + //calculate extents + let normal_transform=transform.matrix3.inverse().transpose(); + let mut aabb=crate::aabb::Aabb::default(); + for vert in mesh.verts(){ + aabb.grow(transform.transform_point3(vert)); + } + Self{ + halfsize:aabb.size()/2, + mesh, + transform, + normal_transform, + } + } fn from_mesh_scale(mesh:PhysicsMesh,scale:Planar64Vec3)->Self{ Self{ halfsize:scale, @@ -1654,8 +1668,8 @@ impl crate::instruction::InstructionConsumer for PhysicsStat } #[allow(dead_code)] -fn test_collision(relative_body:Body,expected_collision_time:Option