diff --git a/src/interaction/hold.rs b/src/interaction/hold.rs index 1ba755b..ce41c68 100644 --- a/src/interaction/hold.rs +++ b/src/interaction/hold.rs @@ -12,5 +12,6 @@ fn hold(q_actor: Query<(&AvianPickupActorState, &GlobalTransform)>) { continue; }; let _transform = transform.compute_transform(); + info!("Hold!") } } diff --git a/src/interaction/pull/find_in_cone.rs b/src/interaction/pull/find_in_cone.rs index 2c25a6e..80bd2fe 100644 --- a/src/interaction/pull/find_in_cone.rs +++ b/src/interaction/pull/find_in_cone.rs @@ -1,5 +1,5 @@ use super::Prop; -use crate::prelude::*; +use crate::{math::METERS_PER_INCH, prelude::*}; /// Inspired by [`CWeaponPhysCannon::FindObjectInCone`](https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/server/hl2/weapon_physcannon.cpp#L2690) pub(super) fn find_prop_in_cone( @@ -8,7 +8,7 @@ pub(super) fn find_prop_in_cone( config: &AvianPickupActor, q_transform: &Query<&GlobalTransform>, ) -> Option { - const MAGIC_OFFSET_ASK_VALVE: f32 = 1.0; + const MAGIC_OFFSET_ASK_VALVE: f32 = 1.0 * METERS_PER_INCH; let mut nearest_dist = config.trace_length + MAGIC_OFFSET_ASK_VALVE; let box_collider = Cuboid::from_size(Vec3::splat(2.0 * nearest_dist)).into(); diff --git a/src/interaction/pull/find_in_trace.rs b/src/interaction/pull/find_in_trace.rs index fa02aca..ad2a5a9 100644 --- a/src/interaction/pull/find_in_trace.rs +++ b/src/interaction/pull/find_in_trace.rs @@ -1,5 +1,5 @@ use super::Prop; -use crate::prelude::*; +use crate::{math::METERS_PER_INCH, prelude::*}; /// Inspired by [`CWeaponPhysCannon::FindObjectTrace`](https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/server/hl2/weapon_physcannon.cpp#L2470) pub(super) fn find_prop_in_trace( @@ -25,7 +25,7 @@ pub(super) fn find_prop_in_trace( .into() } else { let fake_aabb_because_parry_cannot_do_aabb_casts = - Cuboid::from_size(Vec3::splat(MAGIC_FACTOR_ASK_VALVE * 2.)).into(); + Cuboid::from_size(Vec3::splat(MAGIC_FACTOR_ASK_VALVE * METERS_PER_INCH * 2.)).into(); let hit = spatial_query.cast_shape( &fake_aabb_because_parry_cannot_do_aabb_casts, origin.translation, diff --git a/src/lib.rs b/src/lib.rs index 92fc742..f2ac956 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ mod cooldown; mod input; mod interaction; mod spatial_query_filter; +mod math; /// Everything you need to get started with Avian Pickup. pub mod prelude { diff --git a/src/math.rs b/src/math.rs new file mode 100644 index 0000000..17af369 --- /dev/null +++ b/src/math.rs @@ -0,0 +1 @@ +pub(crate) const METERS_PER_INCH: f32 = 0.0254;