The example Draw a simple robot arm in C# shows how to use transformations to draw a robot arm with a “hand” that opens and closes. See that example for the basic explanation.
If you wanted to pick something up with the hand, then you might want the hand to always point downward. Then the question is, “What angle do you need to give the wrist to make the hand always point down?”
It turns out that this isn’t as hard as you might imagine. If the other robot arm joints have angles 0, then the wrist has to have an angle of 90 degrees to point downward. If the other joints don’t have angles of 0, then you simply add them to 90 degrees.
The example uses the following code to calculate the wrist angle.
float wrist_angle = 90 + scrJoint1.Value + scrJoint2.Value;
The rest of the program’s code is the same as in the same as before. See the previous example for additional details.