Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
970 stars 110 forks source link

Carriable is dropped when moved out of drop distance due to moving out to raycast collision point #331

Open OvercastInteractive opened 5 days ago

OvercastInteractive commented 5 days ago

Cogito and Godot Engine Version: Godot 4.3 Cogito beta 202411.01

Description: When carrying a mug and approaching a raycastable surface the carriable is automatically dropped

Reproduction steps: In the breakroom, carry a mug and then aim and move toward a wall

The CarryableComponent leave() function is called, but the actual issue lies in the PlayerInteractionComponent setting a carry destination point that exceeds the carriable's drop distance. For example, carry the flashlight toward a wall and when close enough it will move away from the player and rest against the raycasted surface instead of remaining at its carry_distance_offset.

In PlayerInteractionComponent get_interaction_raycast_tip() the destination_point calculation isn't respecting the CarryableComponent carry_distance_offset and moves the carriable toward the raycasted surface and in doing so it moves it beyond the drop distance for the mug, making it appear as being automatically thrown/dropped.

Expected Behavior: Carried object's destination point should be preferred over the interaction raycast's collision point when it is the closer distance away

This produces the expected behavior: Cogito_Carriable_Destination_Point_Fix_01

OvercastInteractive commented 5 days ago

FYI, while this works it is still just a quick fix and is not the best implementation.

Phazorknight commented 4 days ago

Thanks for flagging this. Have some idea on how to fix/improve this properly. Will take a look.

Phazorknight commented 4 days ago

Okay, so I just pushed a commit that should improve this, but I realized I was still on the PR for the plugin-rework.

Anyway, you can find it here: https://github.com/Phazorknight/Cogito/pull/332/commits/9b8784624d56bddc1c5acc0fd996eec7d094176d