Reputation: 2865
I have a path which will be on bottom of the screen where insects will walk. But my path is not a straight line, it have ups and down. So how can I my insects walk my jagged line? The black line is my path. I want my insects to follow the up and down parts and I would like to achieve this using box2d. Any help? I don't know from where tostart to make this work. I haven't yet started to code. How can I make a bodyDef in box2d for the picture path below?
Upvotes: 1
Views: 346
Reputation: 59496
I assume that with the word "path" you mean the ground represented in the image, otherwise you can ignore the rest of my answer ;)
My suggestion is to follow these steps:
Now you'll see your insects on the ground. If you drag them (using the Mouse Joint provided by box2d) you will see that they react realistically to the ground and do not intersect it.
Finally you need to apply a force (in box2d) in order to autonomously move the insects.
This is just an high-level description of the steps you should follow. More specific information for each step is provided by the PhysicEditor documentation and box2d documentation.
I hope that this is going to help you.
Upvotes: 1