简体   繁体   中英

How to find if top of rectangle collided or not in box2d

I have rectangular player in top down game. I want to find which side(to be specific top of rectangle ) of rectangle is hit by other game objects.

If you want to distinguish between collisions for different parts of your game object, use different fixtures for those parts. So if you want to distinguish between top and bottom for example:

-----------------
|               |
|Top Fixture    |
|               |
-----------------
|               |
|Bottom Fixture |
|               |
-----------------

These could also be sensors (so no physics) as an overlay for your other physics fixtures.

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