简体   繁体   中英

Libgdx collision detection between sprites using border of sprite, not a rectangle or circle

I'm using libgdx in android studio, and I am working with sprite collision detection. I need to know how to detect a collision between two irregularly shaped sprites. My sprites are created from png image textures. Is it possible to use the border of the sprite as the detection surface? Using a rectangle or circle drawn around the sprite will not be accurate enough. Thank you for the help!

Use Box2D which is a great and easy to learn library for physics and lighting. After setting bodies correctly, you can set body shape as rectangle, circle, square or any custom shape using paths, you don't need to worry about collision at all. You only take care what should happen while or after collision

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