From d8f57eb9fa93f3ca6c3eeeb1627031a214032026 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 30 Nov 2023 17:19:56 -0800 Subject: [PATCH] use inverse_times_det --- src/physics.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index e6ce316..8105e2e 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -347,7 +347,7 @@ struct Hitbox{ impl Hitbox{ fn new(mesh:PhysicsMesh,transform:crate::integer::Planar64Affine3)->Self{ //calculate extents - let normal_transform=transform.matrix3.inverse().transpose(); + let normal_transform=transform.matrix3.inverse_times_det().transpose(); let mut aabb=crate::aabb::Aabb::default(); for vert in mesh.verts(){ aabb.grow(transform.transform_point3(vert)); @@ -364,7 +364,7 @@ impl Hitbox{ halfsize:scale, mesh, transform:crate::integer::Planar64Affine3::new(Planar64Mat3::from_diagonal(scale),Planar64Vec3::ZERO), - normal_transform:Planar64Mat3::from_diagonal(scale).inverse().transpose(), + normal_transform:Planar64Mat3::from_diagonal(scale).inverse_times_det().transpose(), } } fn from_mesh_scale_offset(mesh:PhysicsMesh,scale:Planar64Vec3,offset:Planar64Vec3)->Self{ @@ -372,7 +372,7 @@ impl Hitbox{ halfsize:scale, mesh, transform:crate::integer::Planar64Affine3::new(Planar64Mat3::from_diagonal(scale),offset), - normal_transform:Planar64Mat3::from_diagonal(scale).inverse().transpose(), + normal_transform:Planar64Mat3::from_diagonal(scale).inverse_times_det().transpose(), } } fn roblox()->Self{ @@ -783,7 +783,7 @@ pub struct PhysicsModel{ impl PhysicsModel{ pub fn new(mesh_id:usize,attr_id:usize,transform:crate::integer::Planar64Affine3)->Self{ - let normal_transform=transform.matrix3.inverse().transpose(); + let normal_transform=transform.matrix3.inverse_times_det().transpose(); Self{ mesh_id, attr_id,