cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know how to dynamically constrain hand position during grab interaction?

beastus
Level 3

I am using Quest 2 controllers represented as hands. Started with the Complex Grab sample scene. I've created a custom object with custom grab points, hand pose, etc. and that works fine.

What I have been trying to do is, if you have picked up an object the object + hand should collide and not be able to pass through a panel. Think of, for example, drawing on a board. You don't want the pen and hand to simply pass through the board.


I know ways to do this in normal Unity or using XRI Toolkit - it's a fairly trivial thing - but the Interaction SDK is not playing nice.

I also tried deconstructing the pin board prefab and using those OneHandTranslateTransformer and InteractableTransformerConnection components but I couldn't get it to work how I want. For one, they affect rotation as well as position but I just want to constrain position. In addition, those constraints kick in the moment you grab the object, but I need the constraint behavior to happen only when the tool (e.g., a pen) touches a specific object (e.g., drawing board). Couldn't seem to override this via script.

Has anyone done this before with GrabInteractable type of objects? Or more generally, is there a GameObject one can interact with for constraining hand position?

Thank you!

2 REPLIES 2

beastus
Level 3

Related question: If you put a class that implements ITransformer on a GameObject, why does the hand rotation lock during grab interactions? I don't see anywhere in the code for Transformable or any of the ITransformer implementations that do anything that should affect the hand rotation.

It's not the behavior I would expect either, since, for example, there are Translate Transformers and Rotation Transformers, but if I simply add a Translate Transformer (even if no constraints are defined) suddenly the hand rotation gets locked during grabs. At least if it's an object with HandGrabInteractables. It's as if the point in world space in which the grab interaction was initiated becomes the center of rotation for the hand and ceases to update.

beastus
Level 3

UPDATE: I have hacked something together that is *mostly* working the way I want and seems consistent with Interaction SDK. I have created a class that implements ITransformer similar to OneHandTranslateTransformer and OneHandRotateTransformer. I have found it necessary to manage both the position and rotation of the ITransformable instance throughout the updates.
Next, I am going to add a RayCast to be the basis of the constraint rather than what I currently have which is a hard-coded value. If the ray hits an object or class of objects that should block the tool + hand, the appropriate constraint will then be computed and applied.