cancel
Showing results for 
Search instead for 
Did you mean: 

How to snap object with OVR Grabbable?

Jaoewn
Honored Guest
Hello!

I've managed to successfully set up grabbing with Grabber but now I would like to go a step further and only allow grabbing at a specific point. In my case, I am trying to pickup a sword only by the handle, and make sure it always faces the correct orientation. I've looked through the documentation for Grabber/Grabbable but I can't seem to find what I need to execute this.

Thank you for the help! 
15 REPLIES 15

blic_J
Honored Guest
I think that this snapOffset is get World Position

yashgugale
Honored Guest
Just create a box collider and rigid body around the handle of the sword and attach the "OVR Grabbable" script to it. Leave all the options default on the script. This main sword must have a box collider on the blade of the sword and a rigid body, but since there is no "OVR Grabbable" script, you will not be able to pick it up from there. Hope this helps. Worked for me!

RedDeadConejo
Honored Guest
Good, you can solve the problem, resulting in the script 'OVRGrabber' use the global position to make the snap and his thing is that he uses the local one, you can change these parameters of the script and it will work fine!


He just let me upload the code in txt format.

abdulrahman1319
Honored Guest
Did anyone found a solution? thanks 
 

SalvaSabor
Honored Guest
When I Build the scene with this setting I can grab the sword-capsule like a sword. I hope help you
0if0b2memzrc.png

chessiebot
Honored Guest

I know this issue is years old at this point but I have figured out what's up with snap orientation. The OVRGrabber script gets the object's rotation offset by multiplying whatever you put in the snapOffset GameObject with whatever the rotation is in gripTrans (found in the grip transform option within the OVR Grabber component)... which has a default of (0,0,0). Set the gripTransform's rotation to (1,1,1) in the editor and you'll be able to get snap orientation to work.

The jury's still out on snap position, though. I'll come back here if I ever get it figured out.