btHinge2Constraint why anchor move offset the parent axie

Post Reply
chineseoldghost
Posts: 3
Joined: Tue Jun 04, 2013 6:58 am

btHinge2Constraint why anchor move offset the parent axie

Post by chineseoldghost »

i test a btHinge2Constraint,use constraintDemo,when i set all angular limit to zero,the anchor is in the parent axie,but when i set the x axie angular limit to allow the body rotate,the anchor will
move offset the parent axie?why ,and how can is avoid this.

Code: Select all

		btRigidBody* pBodyB = localCreateRigidBody(0.0, tr, shape);
 
		// add some data to build constraint frames
		btVector3 parentAxis(0.f,  1.f, 0.f); 
		btVector3 childAxis(0.f,0.f,  1.f); 
		btVector3 anchor(-20.f,0.f, 0.f);
		btHinge2Constraint* pHinge2 = new btHinge2Constraint(*pBodyB,*pBodyA,  anchor, parentAxis, childAxis);
		//pHinge2->setLowerLimit(0);
		//pHinge2->setUpperLimit(0);
 
		pHinge2->setLinearUpperLimit(btVector3(0,0,4));
		pHinge2->setLinearLowerLimit(btVector3(0,0,2));

		pHinge2->setAngularUpperLimit(btVector3(-2,0,0));
		pHinge2->setAngularLowerLimit(btVector3(2,0,0));
Attachments
see read point,the anchor point
see read point,the anchor point
physicsoffset.jpg (53.58 KiB) Viewed 3817 times
Post Reply