[ODE] Assembling Bodies

Wesley Smith wesley.hoke at gmail.com
Tue Apr 18 11:47:38 MST 2006


Ok, so I'm having some trouble getting the ball and socket thing to
work.  In the code below, I create 2 bodies with linked geoms that are
spheres of radius 0.1.  The bodies are placed equidistant from a ball
joint that connects them.  What I'm expecting to see from the code
below is that they remain coupled yet at a certain distance from each
other.  I'm trying out 2 cases:
1-> where I don't collide the 2 balls and
2-> where I do.

In case 1, the 2 balls end up occupying the exact same space.
In case 2, the 2 balls bounce off the ground with increasing height,
probably from extra energy from the collision of the 2 balls.

Any ideas?  Is there some example code for ball joints.  I saw Jaap's
code for hinge joints already.

thanks,
wes

        float pos[3];
	pos[0] = -0.3f;
	pos[1] = 1.f;
	pos[2] = 0.f;
	
	m_grains[0].setPosition(pos);
	pos[0] = 0.3f;
	m_grains[1].setPosition(pos);
	
	
	dJointID jid = dJointCreateBall(m_grainWorld, 0);
	dJointSetBallAnchor(jid, 0.f, 1.f, 0.f);
	dJointAttach(jid, m_grains[0].bodyID(), m_grains[1].bodyID());



More information about the ODE mailing list