Posted several weeks ago about how to fixate bodies together, the solution then where to either use crossed pin joints or merge the boides into one.
we went with merging, now though we hit a snag and everything would get emensly simpler for us if we used crossed pin joints instead.
the problem is that i cant get it to work.
This is how i do it:
Code: Select all
float l = 0.001f;
m_Cross[0] = cpPinJointNew( m_Bodies[0]->GetBody() , m_Bodies[1]->GetBody() , cpBodyWorld2Local( m_Bodies[0]->GetBody() , cpv( m_Position.x+l , m_Position.y-l )) , cpBodyWorld2Local( m_Bodies[1]->GetBody() , cpv( m_Position.x-l , m_Position.y+l ) ));
m_Cross[1] = cpPinJointNew( m_Bodies[0]->GetBody() , m_Bodies[1]->GetBody() , cpBodyWorld2Local( m_Bodies[0]->GetBody() , cpv( m_Position.x+l , m_Position.y+l )) , cpBodyWorld2Local( m_Bodies[1]->GetBody() , cpv( m_Position.x-l , m_Position.y-l ) ));
cpSpaceAddJoint( World->GetSpace() , m_Cross[0] );
cpSpaceAddJoint( World->GetSpace() , m_Cross[1] );
m_Bodies[0]->DisableCollisions( m_Bodies[1] );
m_Bodies[1]->DisableCollisions( m_Bodies[0] );
can someone with more expierience with chipmunk help me?