ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
357 stars 82 forks source link

Set BasicGrabbable "grabbed" thorugh method call. #209

Closed Pjchardt closed 3 years ago

Pjchardt commented 3 years ago

Is there a way to force a BasicGrabbable to be grabbed via a method call, such that the player's hand, i.e. ViveColliderEventCaster, is not colliding with the BasicGrabbable at the moment the Grab input is pressed, but the BasicGrabbable is grabbed anyway?

My specific use case: Player presses the Grip button over a trigger volume. An object is spawned that has the basicGrabbable component, and the object is immediately set as grabbed by the player's hand.

Thanks.

Pjchardt commented 3 years ago

I was able to resolve my issue. For anyone interested, I overrode ViveColliderEventCaster and added a method that calls eventData.draggingHandlers.Add(obj); ExecuteEvents.Execute(obj, eventData, ExecuteColliderEvents.DragStartHandler); I am not crazy about my solution but it seems to work.