Box2D Forums

It is currently Thu Sep 09, 2010 6:04 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Body moving across platform hanges!
PostPosted: Tue Feb 09, 2010 3:59 am 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
Hi, everyone.

I'm trying to develop a tile engine using Box2D and i'm facing the following problem.

I have one body with one attached box shape. The body has a fixed rotation angle and when I try to walk over a platform which is composed by several tiles, and hence by serveral box shapes, after few seconds moving around the character hanges being impossible to redirect it again.

To change character direction I use the SetLinearVelocity function.

Is there any way to avoid this behaviour?

Thanks.


Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Tue Feb 09, 2010 11:12 am 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2229
See this topic: http://box2d.org/forum/viewtopic.php?f=4&t=4348


Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Tue Feb 09, 2010 12:02 pm 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
Thanks for your reply Erin.

I guess I'll have to adapt my engine code to a newest version of Box2D (I'm currently using 2.0.1) and use 'SetAsEdge' method to define my tiles shapes.

Man at work!


Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Thu Feb 11, 2010 4:21 am 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
The problem persists.

I've ported the engine to the newest version of Box2D and i set edge polygon shapes for each tile in those sides where no tile or a tile of the same type are set.

Now my character keeps stucking between tiles, but after few minutes rather than after few seconds.

As you can see the character hanges while jumping next to the wall although there's an active gravity force.

Any idea about how to fix this?

Thanks.

PD: Remember the reason the why i set different edges for each tile is to be able to interact independently with them. All edges properties are set to zero.


Attachments:
File comment: character stucks between tiles
capture.jpg
capture.jpg [ 105.39 KiB | Viewed 629 times ]
Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Thu Feb 11, 2010 11:22 am 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2229
You need to merge the collinear edges. You will have to create a mapping to the individual tile properties base on the parent edge shape and the contact coordinate.


Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Thu Feb 11, 2010 3:05 pm 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
Thanks again for reply, Erin.

I'll try that way.


Top
 Profile  
 
 Post subject: Re: Body moving across platform hangs
PostPosted: Fri Feb 12, 2010 4:25 am 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
Something more.

The problem also occurs with a single tile block (see the capture). It seems it not only a tile chain problem.

Any idea about how to fix that?

For the moment I'll try to attach circle shapes to the body corners to see if it helps to avoid the tile hangs.

Thanks.


Attachments:
File comment: character hangs to the tile corner.
capture.png
capture.png [ 10.9 KiB | Viewed 591 times ]
Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Fri Feb 12, 2010 9:25 am 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
No way.

Circle shapes didn't help, and my little megaman keeps hanging.

I'll try to find out another work around...


Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Fri Feb 12, 2010 10:05 am 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2229
In that case you are hitting the back side of the bottom edge (normal pointing upwards). Is there are reason you want to use a square shape for your character? Why not a hexagon?


Top
 Profile  
 
 Post subject: Re: Body moving across platform hanges!
PostPosted: Sat Feb 13, 2010 6:18 am 
Offline

Joined: Tue Feb 09, 2010 3:44 am
Posts: 7
Well, the square shape it the wishable one.

About what you tell me, I guess i'll have to find another work around or to do without Box2D and its physics simulation capability.

Anyway, thanks for your attention.

PD: There's no way to fix this problematic behaviour from Box2D source?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 0 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 © 2000, 2002, 2005, 2007 phpBB Group