cancel
Showing results for 
Search instead for 
Did you mean: 

HandPose.cs - Position snapping explanation?

Glightgames
Protege
Hi everyone,

I've removed my previous post and will write it again.
So I've been looking through the OVRTouch stuff and I believe to make objects that can't be moved/held when grabbed, I have to use HandPose.

Does anyone know where the documentation is for this or has anyone used it prior?
I'm trying to setup handles and such that a player can turn but not walk away with.

Thanks.
9 REPLIES 9

Glightgames
Protege
Bump, has no one got this far in their Touch development? 😞

ChrisCas
Protege
The difficulty of this I think is why I think a lot of people make the hands vanish once you pick up an object like Job Simulator. 

You could rig the hand and set up the picking grasp weight that will open and close the hand. 

Glightgames
Protege
Sorry I think I've caused some confusion.
I mean how do we make the draws work?

Glightgames
Protege
OK I've edited my initial post, I hope that makes my question clearer. :smile:

Toukokuu
Protege
Like Chris said majority of the games just hide the hand or have it visible and snap it off if hand moves too far so it might be best to ignore the whole hand pose system..

For the actual code to move the objects there are a lot of tutorials around the net for draggable doors, levers or drawers with mouse where you could just replace movement with hand, search for amnesia unity for example or check VRTK source/demos. Most common way is to just use hinge joints or configurable joints.

Glightgames
Protege
Thanks to everyone who tried to help me with this.

What I've actually gone ahead and done is created a 'Sprint Joint' between the Hand and the Objects in Question.

When the Objects are not being grabbed (Draws for example) they're set as Kinematic so that they don't move.
Grabbing them makes them not Kinematic and makes the Spring Joint work, so they slide towards the hand based on the joint they've been setup with.

Glightgames
Protege
Hi everyone,

Coming back to this I'm still not able to setup 'Hand Poses' that snap to a specific area of the object to fit like a glove.

Here's a video I did quickly:
https://youtu.be/T_bw0ai_il8

You can see unticking 'Allow offhand grab' on the Lava Box does nothing, I can still pick it up from the main collider that's not assigned to the Grabble script.
There's a single small box collider that's at the far right of the object, only that one should be grabbable.

That aside you can see I try setting my Hand Pose to None, Snap & Snap Position. I want to control where the Object will be in the hand or where the Hand will be around the object, these don't seem to be working though?
I've set my Hand Pose's X, Y, Z positions as I'm assuming Snap Position references this?

Any help getting this working would be extremely appreciated!

Thanks,
Dean.

pjenness
Rising Star
I have a secondary script I have made that works along with grabbable.

So for example on a sword I add grabbable and my script.

The sword pivot is where I want to grab but the rotation maybe incorrect (Im using store items so not always how I need out of the box). So I also have a vector3 m_initalRotation value that if I need to rotate a model on pickup it does that.

I also have bool m_doSnap = true, where if set then on grab I parent the item to the hand and zero out the local transforms which  gets the item in the right place. Then unparents again.

Pretty archaic, but works for me.

I leave Allow offhand grab on as then I can actually reposition the hold using both hands ad it feels quite realistic.

Good luck
-P
Drift VFX Visual, Virtual , Vertical Want 970GTX on Macbook for good FPS? https://forums.oculus.com/viewtopic.php?f=26&t=17349

pjenness
Rising Star
Also...
Looking at your video..you have 2 box colliders. On grab maybe the item and the hand colliders are clashing so you can never get the item into the hand ...have you tried setting the item boxcolliders to triggers?

Else you can also force to ignore collisions between objects...Im using that myself somewhere..I just cant remember off hand
https://docs.unity3d.com/ScriptReference/Physics.IgnoreCollision.html

Maybe that might help too

-P


Drift VFX Visual, Virtual , Vertical Want 970GTX on Macbook for good FPS? https://forums.oculus.com/viewtopic.php?f=26&t=17349