Anchor point for pivot joint
-
- Posts: 1
- Joined: Fri Jan 04, 2008 7:15 pm
- Contact:
Anchor point for pivot joint
A small feature request. It would be nice to be able to set anchor points for the pivot joint, and it would also make it more consistent with the other joint types.
-
- Posts: 20
- Joined: Sun Dec 02, 2007 3:54 am
- Contact:
Re: Anchor point for pivot joint
Does a Slide joint with min and max distance set to zero function in the same way? It should.
-
- Posts: 20
- Joined: Sun Dec 02, 2007 3:54 am
- Contact:
Re: Anchor point for pivot joint
Interesting. I JUST wrote the code to display joints (for debug purposes and whatnot), and it appears that the pivot joint has local body coordinate anchor values. This following code works perfectly:
I guess you can try editing the anchor values after creating the joint. Maybe it'll work just fine.
Code: Select all
else if (joint->type == PIVOT)
{
cpPivotJoint * pivotJoint = (cpPivotJoint*) joint;
cpVect pos = cpBodyLocal2World(joint->a,pivotJoint->anchr1);
glColor3f(1,0,1);
glPointSize(4.0);
glBegin(GL_POINTS);
{
glVertex2f(pos.x,pos.y);
}
glEnd();
}
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Anchor point for pivot joint
1) You'd think so, but a slide joint with min/max set to 0 is not the same. Slide joints only work on one axis. You have to solve the constraint differently if you want it to work like a pivot. It probably would work, but I'd think it would be much less stable.
2) The reason why you only get one point for pivot joints is so that you cannot initialize the joint to an invalid state. If the anchor points are too far apart when you create the joint, it would pretty much explode (in the numeric sense) and maybe never recover.
2) The reason why you only get one point for pivot joints is so that you cannot initialize the joint to an invalid state. If the anchor points are too far apart when you create the joint, it would pretty much explode (in the numeric sense) and maybe never recover.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 36 guests