Manually change joint angle and position?

Topics: User Forum
Dec 11, 2010 at 4:19 AM

I have the following crazy ladder.  I want the red bar to rotate (manually via code) around it's center point (yellow dot).  However, I'm not sure what kind of joint to use here to make this work and what angle/cords to set.  The user will be changing the angle of the red bar relative to the joint based on where they touch the green dots.  Also, hopefully not a deal breaker here, but the joint will need to move on its y axis as the user moves the green dots up and down the blue bars.  In the end, the red bar appears to move up and down the blue bars at the same time rotating around its center point (yellow dot).  FYI the red bar can have a very long length if needed.

Coordinator
Dec 12, 2010 at 12:06 AM

Let me get this right: The yellow point can move up and down right?

The two green points are handles that are attached to the bar - and those handles can only move in the blue grooves?

If the two above conditions are correct, you could you a line joint for the two green points.

Dec 12, 2010 at 5:19 AM

Correct and Correct, I will try the line joint then, thanks!

Dec 12, 2010 at 5:42 AM

Ok, so, i will use a LineJoint for the yellow circle and rod (the constructor comments make sense).  For the green circles thats the players fingers on WP7 (Physics Helper).  I managed to get that working (yesterday) except setting the body object position caused tunneling to occur with an object on top of the rod.  So, instead should I apply impulse to the rod?  If so, how do you suggest I set that impulse in a way where the rod appears to move in conjunction with the user touching the green circles (moving them up and down the blue poles) without the rod easing in/out to the finger position, and instead moving in conjunction with the fingers?  Zero gravity maybe?

 A little tip, when the player moves both green circles at the same time is when the rod moves up and down, and when they are moving just one green circle thats when the LineJoint angle will change.  Ideally the rod is always in a state of vertical axis (along the yellow circle) change and its angle change...relative to the green circles y axis and angles respectivly.

Coordinator
Dec 12, 2010 at 10:53 AM

If you are setting the position or rotation of any object manually, you will get weird behavior. You should use ApplyTorque() for rotation and ApplyForce (or impulse) for translation.

If the yellow point can rotate, then use a RevoluteJoint with a motor to make it rotate. If the two green points can move up and down while still allowing the rod between them to rotate, you should use a line joint. (it allows for rotation and translation, but can fix the translation on an axis) See the Testbed sample called LineJointTest for more information.

Dec 12, 2010 at 7:35 PM
Genbox wrote:

If you are setting the position or rotation of any object manually, you will get weird behavior. You should use ApplyTorque() for rotation and ApplyForce (or impulse) for translation.

If the yellow point can rotate, then use a RevoluteJoint with a motor to make it rotate. If the two green points can move up and down while still allowing the rod between them to rotate, you should use a line joint. (it allows for rotation and translation, but can fix the translation on an axis) See the Testbed sample called LineJointTest for more information.

Fantastic!  I'll give this a shot, great help as usual!