3d picking issue

leamer
Posts: 1
Joined: Wed Sep 22, 2010 3:18 am

3d picking issue

Post by leamer »

Hi, I'm using the btPoint2PointConstraint joint to grab an object for 3d picking. But on release of the object, the object moves back along the depth axis. This happens each time on (mouse/iphone touch release), the object progressively moves farther away. Anyone know why this happens?
Here is what I'm using to set up the contraint:

Code: Select all

   selectedBody->setActivationState(ACTIVE_TAG);
                btVector3 localPivot = selectedBody->getCenterOfMassTransform().inverse() * _pickPos;
                btPoint2PointConstraint* p2p = new btPoint2PointConstraint(*selectedBody, localPivot);
                sDynamicsWorld->addConstraint(p2p);
                _pickConstraint = p2p;
                
                btVector3 eyePos(m_cameraPosition.getX(), m_cameraPosition.getY(), _pickPos.getZ() );
                _prevPickingDist = (_pickPos - eyePos).length();
                btVector3 pivotT( 0.0f, 0.0f, 0.0f);
                p2p->setPivotA( pivotT );

Thanks in advance. :o