Skip to content

feature(Interaction): improve grabbing

Daniel Rupp requested to merge daniel.rupp/rwth-vr-toolkit:dev/5.3 into dev/5.3

Here are some problems I encountered with the grabbing behavior.

1. Search for UInteractable at parent component if hit actor is a child actor

Setting: A parent actor that contains a child actor, e.g. a WIM that contains a smaller representation of a real object as child actor. Problem: Currently it is not possible, that the parent actor is grabbable, if the child actor is not grabbable. Reason: In GrabComponent.cpp a sphere cast is done to find objects close by. If the sphere cast hits the child actor we search for UInteractableComponent in the child actor, which we do not want to be grabbable, therefore there is no UInteractableComponent.

Solution:

  • Provide a way to specify the actor that should move (parent or child etc.). Since this might be an edge case, I just used a boolean flag for now that per default behaves like before.

2. Expose a TryRealease() function that releases the currently grabbed object

3. InteractableComponent can broadcast OnActionStart events without requiring hover to be called first.

This is a little bit misleading. I kind of expect, if I subscribe to the OnActionBegin event in the grabbing component, that this is called after the object has successfully been grabbed. I now added OnBeginGrab/OnEndGrab events returning the grabbed object and a IsObjectGrabbed() function

Discussion: I think in general, OnActioStart events should only be called if we currently hover.

4. GrabbablesInRange.AddUnique() in GrabComponent.cpp

An actor can have multiple static meshes, that return a collision, therefore we would add the same actor multiple times which is probably unwanted behavior.

5. Added option to only grab closest object

Edited by Daniel Rupp

Merge request reports

Loading