diff --git a/src/actor.rs b/src/actor.rs index 4d3bdfe..2dc3b5b 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -4,7 +4,10 @@ use bevy::{ prelude::*, }; -use crate::prelude::Cooldown; +use crate::{ + interaction::{GrabParams, ShadowParams}, + prelude::Cooldown, +}; pub(super) mod prelude { pub use super::{AvianPickupActor, AvianPickupActorState}; @@ -118,9 +121,12 @@ impl Component for AvianPickupActor { fn register_component_hooks(hooks: &mut ComponentHooks) { hooks.on_add(|mut world, targeted_entity, _component_id| { let mut commands = world.commands(); - commands - .entity(targeted_entity) - .insert((AvianPickupActorState::default(), Cooldown::default())); + commands.entity(targeted_entity).insert(( + AvianPickupActorState::default(), + Cooldown::default(), + GrabParams::default(), + ShadowParams::default(), + )); }); } } diff --git a/src/interaction.rs b/src/interaction.rs index 4b882ce..dce1937 100644 --- a/src/interaction.rs +++ b/src/interaction.rs @@ -5,7 +5,7 @@ mod hold; mod pull; mod throw; -pub(crate) use self::{drop::DropObject, pull::PullObject, throw::ThrowObject}; +pub(crate) use self::{drop::DropObject, hold::prelude::*, pull::PullObject, throw::ThrowObject}; pub(super) fn plugin(app: &mut App) { app.add_plugins((hold::plugin, pull::plugin, drop::plugin, throw::plugin)); diff --git a/src/interaction/hold.rs b/src/interaction/hold.rs index 4ecc59c..45fc89d 100644 --- a/src/interaction/hold.rs +++ b/src/interaction/hold.rs @@ -1,3 +1,5 @@ +use std::f32::consts::TAU; + use crate::prelude::*; pub(super) fn plugin(app: &mut App) { @@ -6,52 +8,39 @@ pub(super) fn plugin(app: &mut App) { .add_systems(hold.in_set(AvianPickupSystem::HoldObject)); } -fn hold(q_actor: Query<(&AvianPickupActorState, &GlobalTransform)>) { - for (&state, transform) in q_actor.iter() { - let AvianPickupActorState::Holding(_entity) = state else { - continue; - }; - let _transform = transform.compute_transform(); - info!("Hold!") - } +pub(super) mod prelude { + pub(crate) use super::{GrabParams, ShadowParams}; } -#[derive(Debug, Copy, Clone, Component)] -struct ShadowParams { - target_position: Vec3, - target_rotation: Quat, - max_angular: f32, - max_damp_angular: f32, - max_speed: f32, - max_damp_speed: f32, - // damp_factor = 1 - // teleport_distance = 0 -} - -#[derive(Debug, Copy, Clone, Component)] -struct GrabParams { - contact_amount: f32, - time_to_arrive: f32, - /// Todo: this is never read - error_time: f32, -} - -fn grabcontroller_simulate( +/// Basically GrabController::Simulate +fn hold( time: Res