Hold rigid body at certain position

Kepakiano
Posts: 2
Joined: Fri Nov 01, 2013 7:25 am

Hold rigid body at certain position

Post by Kepakiano »

Hey there,

I have a controller (a PS Move controller in fact) with a position, pointing direction and orientation. Right now, I'm trying to point at an object in my scene and click a button to pick it up. The ray test is set up, but I can't seem to implement the picking up correctly. I have two rigid bodies, controllerRB and pickingRB (both kinematic). When I click the button, I translate the pickingRB to the position of the object I want to pick up. Then the vector between controller and object is calculated and in every frame, the pickingRB's position will be updated if the controllerRB moved or I manually change the distance between the objects. This should drag the object in the correct position. The controller direction is not yet taking into account.
Somehow, when I click, the object jumps away a little and then returns to the correct position.

So, I'm coming to the conclusion, that I've been going about this all wrong, because I'm not really an expert on bullet.

I thought, putting an object at a certain position and orientation would be a piece of cake, but obviously I failed^^
How would you guys implement this?

Thank you.
mdoug
Posts: 2
Joined: Mon Oct 28, 2013 11:23 am

Re: Hold rigid body at certain position

Post by mdoug »

I'm no expert either, but I was wondering if maybe you forgot to disable collisions between the object you are trying to pick up and pickingRB, which would explain why it moves when you move the pickingRB on top of it.
Kepakiano
Posts: 2
Joined: Fri Nov 01, 2013 7:25 am

Re: Hold rigid body at certain position

Post by Kepakiano »

Yes, I did. Thank you very much!