简体   繁体   中英

box2d circular body stuck in corners

Good day, I have a circular body which rolls in a certain direction. Some platforms in my game are built perpendicular to each other forming a 90 degrees corner like _| (without the gap :)) My problem is that the circular body gets stuck between the two platforms if it collides with the corner. Only by implying an impulse the body is released but gravity does not seem to affect it anymore.

I have seen posts with solutions but they were all referring to square character bodies.

Has anyone here have a suggestion about this issue ?

Thanks

I think the problem may be that the circular body has come to rest and has therefore gone 'to sleep'. Check out the Sleep Parameters section of http://www.box2d.org/manual.html and try the following when you create your bodyDef:

bodyDef.allowSleep = false;

Alternatively you can use some external event to wake up your sleeping body:

myBody->setAwake(true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM