cancel
Showing results for 
Search instead for 
Did you mean: 

Pulling the sword from the stone!

Avotas
Explorer

Question for everyone. I am attempting to use The Meta XR Interaction SDK (v64.0 on Unity 2022.3) to pull a sword from a stone. The sword uses Meta's 'One Grab Free Transformer' with constraints on the X,Z to prevent the sword from wobbling. At a certain height (Y) I want to release those constraints so the sword can be wielded in all three dimensions.

Can constraints be targeted/altered programmatically? Is there a better method to achieve a similar result?

1 ACCEPTED SOLUTION

Accepted Solutions

Avotas
Explorer

Solution: A prefab swap (with and without the constraint) was used as workaround. By tracking the last hand used [_lastHandGrabInteractor] and then forcing a drop [_lastHandGrabInteractor.ForceRelease()] I was able to attach the substituted prefab with [_lastHandGrabInteractor.ForceSelect(replacementObject, true]. It's not a perfect solution, but it was successful.

View solution in original post

3 REPLIES 3

swang81
Protege

1. when controller model overlap with the sword (+ hand grab action), the sword will move along Z axis with controller Z movement.

2. when Z movement >= max length,  attach the sword to your hand(controller) 

Avotas
Explorer

Solution: A prefab swap (with and without the constraint) was used as workaround. By tracking the last hand used [_lastHandGrabInteractor] and then forcing a drop [_lastHandGrabInteractor.ForceRelease()] I was able to attach the substituted prefab with [_lastHandGrabInteractor.ForceSelect(replacementObject, true]. It's not a perfect solution, but it was successful.

Thank you. It was a good secondary solution!