How to set transform frames in constraints

Machinou
Posts: 2
Joined: Mon Sep 17, 2007 1:22 pm

How to set transform frames in constraints

Post by Machinou »

Hi,
I'm currently experiencing problem while setting the ConeTwistConstraint to build a ragdoll from some xml file exported using 3dsmax. I don't really get how to set the last two parameters of the constructor :

Code: Select all

btConeTwistConstraint(btRigidBody& rbA,btRigidBody& rbB,const btTransform& rbAFrame, const btTransform& rbBFrame);
While I was able to get the Hinge constraint working after some experiments, here I'm stuck... Has anyone a link or some information that explains how to set the transform ?

Thanks,
Etienne
Machinou
Posts: 2
Joined: Mon Sep 17, 2007 1:22 pm

Re: How to set transform frames in constraints

Post by Machinou »

If someone is also wondering, the x axis is considered as the one which twists, so I've set my frames like in the example below.
Image.


But then I've another question :)
----

If I understand well, projection on axis X of rigid body B into the plane (Y, Z) of body A, must be constrained inside an ellipse (which means u²/a² + v²/b² < 1).

Image.

Then I would have written the test of being or not in the ellipse with:
u = btSin(swing1)
a = btSin(m_swingSpan1)
v = btSin(swing2)
b = btSin(m_swingSpan2).

I find that the parameters of SetLimit() with this change, now really means angles, whereas I am a bit surprised
with the limit my limbs can reach with the current code.

Could someone explain me the current test (EDIT: sorry it was a wrong snippet)

Code: Select all

	btScalar RMaxAngle1Sq = 1.0f / (m_swingSpan1*m_swingSpan1);		
	btScalar RMaxAngle2Sq = 1.0f / (m_swingSpan2*m_swingSpan2);	
	btScalar EllipseAngle = btFabs(swing1)* RMaxAngle1Sq + btFabs(swing2) * RMaxAngle2Sq;

	if (EllipseAngle > 1.0f)
	{
		//solve limit
	}
?

thanks,
Etienne
Last edited by Machinou on Wed Sep 19, 2007 5:11 pm, edited 1 time in total.
AlexSilverman
Posts: 141
Joined: Mon Jul 02, 2007 5:12 pm

Re: How to set transform frames in constraints

Post by AlexSilverman »

I posted some stuff about this constraint a while back.

http://www.bulletphysics.com/Bullet/php ... f=9&t=1411

Nobody replied, so I've been working on the assumption that what I wrote was correct, but maybe you've got a deeper understanding than I do, or we've got new eyes watching this thread.

- Alex