Skip to main content
New Participant
April 27, 2024
Solved

Pulling the sword from the stone!

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?

AvotasAnswer
New Participant
May 5, 2024

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.

3 replies

Inspiring
April 29, 2024

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) 

AvotasAuthor
New Participant
May 5, 2024

Thank you. It was a good secondary solution!

AvotasAuthorAnswer
New Participant
May 5, 2024

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.