Skip to content

Best way to temporarily connect two objects in a rigid way (PyBullet)? #4483

Answered by Avithohol
narittt asked this question in Q&A
Discussion options

You must be logged in to vote

Try to figure out the point in 3d space where the body gets picked by, then create a simple point to point constraint and keep it while the body is "picked up":

			btVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
			mPickConstraint = std::make_unique<btPoint2PointConstraint>(*body, localPivot);
			mDynamicsWorld->addConstraint(mPickConstraint.get(), true);
			mPickConstraint->m_setting.m_impulseClamp = 3.0f;
			mPickConstraint->m_setting.m_tau = 0.01f; //weak constarint

if you wanna grab the body around by the picking point, then you need to change the frame:

glm::vec3 pivotPoint = oldPos + newPos;
btVector3 newPivotB(pivotPoint.x, pivotPoint.y, pivotPoint.z);…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@narittt
Comment options

@Ghassan-Nafash
Comment options

@Ghassan-Nafash
Comment options

Answer selected by narittt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants