Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
OvercastInteractive opened this issue Nov 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@OvercastInteractive
Copy link
Collaborator

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 OvercastInteractive added the bug Something isn't working label Nov 21, 2024
@OvercastInteractive OvercastInteractive changed the title Carriable is dropped when looking at a wall Carriable is dropped when moved out of drop distance due to moving out to raycast collision point Nov 21, 2024
@OvercastInteractive
Copy link
Collaborator Author

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

@Phazorknight
Copy link
Owner

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

Phazorknight added a commit that referenced this issue Nov 21, 2024
Changed the way carryable position is calculated (as pointed out in issue #331 ).
This adds a simple marker3D as a position node, but technically this is not required.
@Phazorknight
Copy link
Owner

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: 9b87846

@OvercastInteractive
Copy link
Collaborator Author

This works well, thanks @Phazorknight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants