Skip to content

Commit

Permalink
Fix unit conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Jul 6, 2024
1 parent 269f846 commit 91d4696
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/interaction/hold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ fn hold(q_actor: Query<(&AvianPickupActorState, &GlobalTransform)>) {
continue;
};
let _transform = transform.compute_transform();
info!("Hold!")
}
}
4 changes: 2 additions & 2 deletions src/interaction/pull/find_in_cone.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -8,7 +8,7 @@ pub(super) fn find_prop_in_cone(
config: &AvianPickupActor,
q_transform: &Query<&GlobalTransform>,
) -> Option<Prop> {
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();

Expand Down
4 changes: 2 additions & 2 deletions src/interaction/pull/find_in_trace.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/math.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub(crate) const METERS_PER_INCH: f32 = 0.0254;

0 comments on commit 91d4696

Please sign in to comment.