hi all. i make game using box2d. In my game main hero is robot, but i dont know, how do i make him walk. I want my robot walks like in this movie http://www.youtube.com/watch?v=i46pP0bC2x0&feature=player_embedded#! on 7 min 20 sec. How can i do this ❓
robot legs
General DiscussionYour simple question would result in a very complex answer. To begin with, I'd recommend you to get familiar with Box2D's standard features, and maybe making a different game to begin with to get to know it better. When you've become more familiarized with the library, you might be able to imagine how such a thing would work in whole, and finally you could get help with more specific questions.
A simple and fairly obvious answer:
In the video, the robot is nicely done with balancing on the slope and all that, which I assume is what you're after. The legs seem to be made out of joints and the body's orientation to be fixed, at least when it's active and walking. The balance would be quite hard to achieve, I can't imagine quite how it'd be done. If you've never made a game before, I'd advice you to postpone this feature until you get more skilled at programming.
I'd advise you to actually contact the developers of the game in the video. You might not get the source but you might get a few pointers and suggestions if you're lucky.
A simple and fairly obvious answer:
In the video, the robot is nicely done with balancing on the slope and all that, which I assume is what you're after. The legs seem to be made out of joints and the body's orientation to be fixed, at least when it's active and walking. The balance would be quite hard to achieve, I can't imagine quite how it'd be done. If you've never made a game before, I'd advice you to postpone this feature until you get more skilled at programming.
I'd advise you to actually contact the developers of the game in the video. You might not get the source but you might get a few pointers and suggestions if you're lucky.
Zoomulator wrote:
A simple and fairly obvious answer:
In the video, the robot is nicely done with balancing on the slope and all that, which I assume is what you're after. The legs seem to be made out of joints and the body's orientation to be fixed, at least when it's active and walking. The balance would be quite hard to achieve, I can't imagine quite how it'd be done. If you've never made a game before, I'd advice you to postpone this feature until you get more skilled at programming.
In the video, the robot is nicely done with balancing on the slope and all that, which I assume is what you're after. The legs seem to be made out of joints and the body's orientation to be fixed, at least when it's active and walking. The balance would be quite hard to achieve, I can't imagine quite how it'd be done. If you've never made a game before, I'd advice you to postpone this feature until you get more skilled at programming.
huh?
btw, what's hard? Just make it! Legs are gonna be heavy. That's all...
@Neasano
My point is that moving the legs without screwing the physics up is what's difficult. You can always just do it, but it's likely you'll knock yourself into a dead end if you're not up to it. Learn to crawl before you can run and all that...
There's a point in making it bottom heavy for balance's sake, which I suppose you mean by the legs being heavy. I don't think that alone would do though. It'd be nice to know how you figure it would work, so please elaborate.
My point is that moving the legs without screwing the physics up is what's difficult. You can always just do it, but it's likely you'll knock yourself into a dead end if you're not up to it. Learn to crawl before you can run and all that...
There's a point in making it bottom heavy for balance's sake, which I suppose you mean by the legs being heavy. I don't think that alone would do though. It'd be nice to know how you figure it would work, so please elaborate.
Zoomulator wrote:
@Neasano
My point is that moving the legs without screwing the physics up is what's difficult. You can always just do it, but it's likely you'll knock yourself into a dead end if you're not up to it. Learn to crawl before you can run and all that...
There's a point in making it bottom heavy for balance's sake, which I suppose you mean by the legs being heavy. I don't think that alone would do though. It'd be nice to know how you figure it would work, so please elaborate.
My point is that moving the legs without screwing the physics up is what's difficult. You can always just do it, but it's likely you'll knock yourself into a dead end if you're not up to it. Learn to crawl before you can run and all that...
There's a point in making it bottom heavy for balance's sake, which I suppose you mean by the legs being heavy. I don't think that alone would do though. It'd be nice to know how you figure it would work, so please elaborate.
I watched this vid http://www.youtube.com/watch?v=O1zT5GJUQn0
And got some more thoughts...
If you watch this video attentively, you'll find that only ONE leg is moving at the time, other one looks like it's glued to the ground(Even when the robot is REALLY unbalanced!). Or it becomes a static body, or distance joint is used. I guess it's first.
Other robot parts are not controlled(by a walking thing). Everything else is moving like a spring. Just find a way to move leg around the other one. It's pretty simple.
Neosano wrote:
It's pretty simple.
Neosano, unless you've implemented something like this yourself, I don't think you can reasonably say with certainty that 'it's pretty simple'. (And if you *have* implemented something like this successfully, perhaps you could post a link and/or describe the methods that you used.)
As for how it's done, I'm not sure myself, but it seems at least possible that inverse kinematics are involved.
Neosano wrote:
If you watch this video attentively, you'll find that only ONE leg is moving at the time, other one looks like it's glued to the ground(Even when the robot is REALLY unbalanced!). Or it becomes a static body, or distance joint is used. I guess it's first.
Other robot parts are not controlled(by a walking thing). Everything else is moving like a spring. Just find a way to move leg around the other one. It's pretty simple.
Other robot parts are not controlled(by a walking thing). Everything else is moving like a spring. Just find a way to move leg around the other one. It's pretty simple.
I wouldn't call all that swapping and special cases to be "really simple", but it's a possible and doable solution. The two legs would be separated by the filters in Box2D, so that's easily taken care of.
Another, very complex way, and I'd say more true to the physics engine, would involve the center of mass. For an object to remain in balance it needs to have it's COM (a.k.a center of gravity in this case) supported by a base directly under it. If the COM goes to the side of the base it tips over. Simple so far.
If you keep track of the footing you'd get a base between the two ground contacts. You could make the legs react if the COM gets too close to an edge so that the leg would straighten out, and the other one contract. If the COM gets so close and the legs can't do anything more by standing there, it'd move the opposing leg forward to regain base.
The tricky part would be moving, I think. Maybe it's as easy as moving the body/torso forward and let the legs react. I doubt it'd work without any modifications though. I'm sure all of it would require insane amounts of calibration, if you even get that far.
Crazy enough to work?
Original thread: https://box2d.org/forum/viewtopic.php?t=4920