Sign in to follow this  

2D skeletal movement physics

This topic is 3735 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all! As I'm heading on my voyage towards awesome general physics [how geeky do I sound now!] I was wondering what was the best way to implement skeletal movement in a 2D platformer. I am not talking about the animation but rather about the movement itself. What I would like is to define the most general set of rules for this. For example, the legs: Instead of the player moving left and right as in all platformers, the left and right movement will be a "side-effect" of the legs [made up of a couple of bones and joints] applying force - so the player will also move up and down on the y-axis. Has this been done? When? Why? How?! Who?! Thanks in advance, Ori

Share this post


Link to post
Share on other sites
I guess the question you'll have to answer is how accurate do you want it to be and how humanoid do you want your character to be? There are several high performance 2D physics libraries around, eg Chipmunk. The problem with animating using physics is simple. The character needs to move in an intelligent and dynamic way. On flat ground your character might walk fine... but how does he react to tripping on a step? Rather than simply playing an animation and moving him around, you need to have an intelligent walking algorithm that can deal with various obstacles he might be presented and even to keep him standing. There are various solutions that can make your life easier. One is to treat him like a puppet... this means you "carry him" by a force that tries to keep his head a set distance from the ground (probably a spring pushing his head to a point above his current centre of gravity by an appropriate distance). Assuming the joints have appropriate limits set, you can then animate his limbs to look like walking with a simple walk cycle that just applies a force to his feet to make him step on the next piece of scenery. I think his walking should effectively be independant of his balancing (possible deactivating when he is stationary, leaving only balance) ie if a force pushes him one way or other his legs will walk. This would mean you can animate him by simply applying a force left/right. In practise this'd mean in the absence of force he'll stand... when the player tries to make him move, a force will be applied that would off-balance him and his leg animation will run (combining with the balance he should stay up). As for other programs that have used this method, I'm not... but it's something that people have tried often, how to exert explicit control over a physical environment (or blend motion captured animation with physics). There is a very nice package that illustrates this called Endorphin. Motion capture can be applied in a way that effectively converts it to muscle motion, the character can be animated with various AI operations (like balancing or reaching for objects) and to blend in and out of canned and dynamic animation as appropriate.
Good luck!

Dan

Share this post


Link to post
Share on other sites
It works usually the other way round.

You surround your character with a bounding volume. Then you move the limbs according to the speed, and place the feet and hands using inverse kinematics. Doing it the other way round (the 'real life' way) is extremly complicated (for fun factor, look for sumotori dreams).

Would be an interesting project though. If you look at the state of research in robotics and locomotion, it's pretty impressive what we can achieve (after 10's of years of trying!). And yet, the amount of work that goes into it boggles the mind.

Share this post


Link to post
Share on other sites

This topic is 3735 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this