Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
118 stars 1 forks source link

"Reeling in" a grabbable object with your laser re-grabs it #2002

Open JackTheFoxOtter opened 1 month ago

JackTheFoxOtter commented 1 month ago

Describe the bug?

When you "reel in" an object with your laser, the object is supposed to transition into a physically grabbed state. However, it appears as if the object is briefly parented to the reparent target of the Grabbable component during this transition.

[Shifty Edit]: While in VR with physical grabbing disabled, the grabbable object will be dropped compared to desktop where it remains grabbed (and physical grabbing doesn't exist).

This re-grabbing will also trigger "OnGrabbableGrabbed" and send an impulse.

To Reproduce

Take a grabbable object, and create a SlotChildrenEvents node for the reparent target of the Grabbable component. Then grab the object with your laser and reel it in. You should see that both "ChildAdded" and "ChildRemoved" fire in the same update.

Expected behavior

Transitioning an object from laser grabbed to physically grabbed should not briefly parent it to the reparent target of the Grabbable component.

Screenshots

No response

Resonite Version Number

Beta 2024.5.7.505

What Platforms does this occur on?

Windows

What headset if any do you use?

Valve Index

Log Files

N/A

Additional Context

This becomes problematic in worlds that have a "cleanup" system which automatically reparents objects when they are released by a user. The issue is that the object gets "ripped out" of your hand, so it won't actually end up being physically grabbed, instead it will cancel the grabbing action. Preventing the object from being reparented / released during the transition would fix this. It also causes an issue with my LiteBlock system as the snapping code incorrectly runs during this, ripping the block out of your hand and breaking the animation. (Which depends on reparenting the slot to a intermediate "mover" parent)

Reporters

No response

shiftyscales commented 1 month ago

This may be a consequence of how this mechanism was originally implemented. If you have physical grabbing disabled in VR, you will actually outright drop the object you were reeling in- presumably because it is trying to attempt to re-grab it physically after dropping the remote grab.

Regardless, behaviour like the aforementioned is an issue on its own, even without involving additional systems, etc.

Seeking input from @Frooxius or @ProbablePrime.

should not briefly parent it to the reparent target of the Grabbable component.

Do you have "ReparentOnRelease" enabled, @JackTheFoxOtter? Does that setting make any difference to your issue?

Regardless- it would be better to focus this issue on the underlying problem- that the transition to physically grabbing from a remote grab momentarily un-grabs and re-grabs the grabbable.

As an additional test- could you use an OnGrabbableGrabbed node and see if it fires off a second impulse during the transition too? That would confirm my suspicion that it is switching between the grab modes by un-grabbing and re-grabbing.

JackTheFoxOtter commented 1 month ago

Do you have "ReparentOnRelease" enabled, @JackTheFoxOtter? Does that setting make any difference to your issue?

I tested with and without. Both cause the outlined behavior.

As an additional test- could you use an OnGrabbableGrabbed node and see if it fires off a second impulse during the transition too? That would confirm my suspicion that it is switching between the grab modes by un-grabbing and re-grabbing.

OnGrabbableGrabbed does fire during the transition, interestingly OnGrabbableReleased doesn't though.

Frooxius commented 1 month ago

Yeah this isn't really a bug, it's just how this works - to move it from laser grab to physical, it removes it from laser and then re-grabs it physically immediately after.

We can change the behavior here potentially.

shiftyscales commented 1 month ago

Based on your prior findings- that could be because it happens in the same update @JackTheFoxOtter. So there isn't an update/frame in which it is not grabbed technically.

Updating the issue title to reflect the underlying issue, that the attempted re-grab causes some issues.

As mentioned above (and appended to the original post), there are undesirable behaviours that arise from the existing behaviour, e.g. if your grab mode is set to lasers only, it will still attempt to make the transition to physical grab causing you to drop the object, @Frooxius.

JackTheFoxOtter commented 1 month ago

Based on your prior findings- that could be because it happens in the same update @JackTheFoxOtter. So there isn't an update/frame in which it is not grabbed technically.

I doubt that. They are events, they should just fire when triggered regardless of the last update. If they don't fire they probably don't get triggered.