cancel
Showing results for 
Search instead for 
Did you mean: 

Keep an object grabbed in a hand

cibernaio
Protege
Hi,
I'm a beginner, I've seen the examples of grab, distance grab of Oculus,
I would like:
1- after taking an object with the grab, have it remain in my hand after I release the grip button, such as a racket in my hand.
2- I'd like to initialize an object when I click the grip button and that it gets grabbed in my hand, like a ball.
 
Could someone suggest me some examples?
 
Thank you
 
8 REPLIES 8

AWFlat
Honored Guest

1. You could set the object as a child of the hand transform, thereby having it follow the movement of the hand despite having released the grip button.
2. Instantiate an object and use the hand transform as a parent. If you want the hand to hold the ball properly I suggest looking at the Handgrabpose examples 

cibernaio
Protege

Hello,

i tried to attach my object(that could be a simple cube with rigidbody and collider) to the RightControllerAnchor as a child, however I have these problems:

if set "uses gravity" on rigidbody, the object keeps falling to the floor

if i remove the gravity i can move it but it flies in the air.

if I set only kinematic the object is perfect, it follow my controller movements but the collide with other objects doesn't work anymore.

last test: if i add to my object a fixed joint and as body i select the hand right controller, then it works but my entire body with the camera rig is being pushed around by gravity.

So at the moment i can't find a working solution.

Thanks

 

Is the Collider a box collider, or mesh collider? Is it set to convex? Sometimes that is needed for collisions to work properly. When listening to a collision event do you use OnCollisionEnter or OnTriggerEnter?

Hi,

tested both, box collider or mesh collider + convex, same behavior,

My test is very easy, i don't use any onCollision Event,

i simply attached a cube to the controller.

 

aaa.png

 

com.DefaultCompany.PadelTrainer-20230125-182124.jpg

com.DefaultCompany.PadelTrainer-20230125-182127.jpg

 

com.DefaultCompany.PadelTrainer-20230125-182131.jpg

The cube attached to the controller when collide with the sphere, is not the sphere to move, is the cube that non remains attached to the parent controller

AWFlat
Honored Guest

I'm lost. Do you want the sphere to move and not the cube?

I summarize it like this:

I would like to have a racket that has a rigid body and therefore can hit a ball.

But I don't want grab it and hold it with the grip button pressed all the time.

Hence your idea of ​​attaching the object, in this case a racket, (or a cube) directly to the parent of controller, however I can't do it as the object flies away, it doesn't stay attached.

Ok, try this. 
If you put rigidbody with is kinematic and gravity is set to false on the cube that is child of the hand object, try to freeze position/rotation in the constraints section of the rigidbody. If you put the rigidbody on the sphere as kinematic and not using gravity you should now be able to move the sphere by "pushing" the cube against it. If you want the sphere to fly away I guess you would want to activate gravity when collided and tweak the mass and physics materials. 

I think you might have better luck in finding answers regarding this on the unity forums as this is a heavily Unity based question rather than Oculus. 

Hope that helps

At the end I can say this:
if I put the racket linked to the parent hand,
later for example the ball doesn't work well, if I move the racket fast the ball goes through it, even setting the collision to continuos/dynamic
 
if instead I regularly use the handgrab and grab the racket, it works perfectly. The fact remains that I have to hold down the grip button all the time.