18 years ago
The subject says it all :), but I'll try to be more specific. I'm
trying to build a 2-d model of a simple (human) stick figure for a 2-d
rock-climbing game I'm writing for fun in Java. I would like to do it
in a nice object-oriented way, but more importantly, I want to be able
to do the following: keeping 2 feet and 1 hand fixed in position, I
want to be able to grab the other hand and move it to an exact
location, and have the body follow. The main constraints are: the
limbs are not elastic, and the joints each have a range of motion that
cannot be exceeded.
I can see that when I move the right hand, often there will be an
infinite number of possible "solutions" or positions of the rest of
the body, so I will need additional constraints. Ideally, the other
hand and feet will support the weight of the figure, and I will
calculate the body position support the body and maximize efficiency
(ie. so the 'climber' doesn't get tired quickly)
I am not a mech. engineer, so I'm partly doing this as an exercise to
learn how to model a 2-d figure and add "realistic" features, such as
the inverse kinematics and also balance and various forces.
I'd like to start with something simple that I can understand, so if
anyone has simple examples that are similar, that would be helpful.
Also, online tutorials or even just suggestions for how to "model"
this figure would be useful. I'm pretty much a beginner, but
interested in learning. I realize there is already a 3-d climbing
game, and I also realize there is complex software to handle this
stuff, but I'm interested in this ground-up approach, since I really
want to learn as much as possible.
Here is the basic configuration of the stick figure (open to slight
I.e. the "fixed points" are the hands and feet (except the one being
moved by the user/player), and the points to be automatically
positioned are the elbows, knees, "neck" (point where arms, head and
torso join) and "hips" (point where legs and torso join) I would like
to be able to pick any hand/foot and move it and have the rest of the
body follow based on 'balance' and 'strength'.
I think I am starting to understand that the position of each joint is
subject to "limb" length, and then I have to impose these other
constraints so that I end up minimizing/maximizing a function. I just
don't quite know how to set that up.
Pseudocode/general algorithm data-structure hints are very welcome
Please email response.
Thanks for your patience and any help or guidance!