Box2D Forums

It is currently Sat May 18, 2013 2:06 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Platformer Physics
PostPosted: Fri Mar 02, 2012 1:34 am 
Offline

Joined: Fri Mar 02, 2012 1:22 am
Posts: 1
Hi everyone

So I have been making a small platform game with Box2D in C# using the Farseer wrapper. Its going quite well, and to do maps I am using a tile based version, which I am loading from a small image file and then creating static rectangular bodies for each pixel of a certain colour. It works well.

However when my player moves over them there are a couple of issues. Using a rectangular collider, the player gets snagged on the tiles. After researching the issue, I tried out a capsule collider, which when moving over the tiles seemed to "bob" very irregularly.

I am not sure quite how I would go about merging two touching bodies into one and then still drawing them individually.

Anyhelp is greatly appreciated.


Top
 Profile  
 
 Post subject: Re: Platformer Physics
PostPosted: Mon Mar 05, 2012 4:24 am 
Offline

Joined: Tue Dec 20, 2011 2:19 pm
Posts: 10
You can solve this problem with edge shapes. What I did is generate edge shapes for all edges of tiles that were next to open tiles, creating an outline of edges. Then I did a query on every edge point to find the other edge and connect them together. Little tricky, check the box2d manual for more details.

To see a 48 game contest game in action using this method, try this out:

http://www.wolverinesoft.org/game/207/wraith-dungeon

Need an analog joystick to play.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group