I can do 2d collision detection of boxes and circles ,but I have a question . How can I do collision detection in this situation (1,2).I am using libGDX game engine for creating games.
Asked
Active
Viewed 226 times
0
-
How is (2) defined? As a bitmap? Vectors? – Jongware Jul 05 '14 at 15:32
-
So "bitmap", then. How is (1) defined? As a mathematical circle (center, radius), or also as a bitmap? – Jongware Jul 05 '14 at 15:34
-
again bitmap ... which is better? mathematical cicle or bitmap ? it is easy get bitmap center and radius – Vahe Muradyan Jul 05 '14 at 15:35
-
"Better" is in the eye of the beholder. Math is easier, for me. For bitmaps, read http://stackoverflow.com/questions/5914911/pixel-perfect-collision-detection-android – Jongware Jul 05 '14 at 15:38
-
https://lh4.ggpht.com/Go0_Up1ufscBIWz2g0z-kh08ivvHRb51Nn9yOY2I53nV6WU1ZLD4adbJoAqDhJfmOw=h900 I think you know this game . how it understands that player and ground are collidered ? – Vahe Muradyan Jul 05 '14 at 15:42
-
1@user3693550 ,probably its using box2d,the ground is a polygon and the tires of the car are circles , box2d is doing all the job. – SteveL Jul 05 '14 at 15:52
-
so the ground is not a bitmap?or bitmap can be polygon too ? – Vahe Muradyan Jul 05 '14 at 18:29
-
1Its probably just a `Texture` that fits the `Polygon`. Posibly the `Texture` is a simple square and it is stretched regarding the hight of the current area. So both, the polygons and the view depend on this variable height, which could be generated randomly. – Robert P Jul 07 '14 at 09:18
1 Answers
0
Fixture (1) in your world should most likely be a ChainShape
. ChainShapes are determined by an array of Vector2
objects, the more you have, the smoother the ChainShape
tends to be.
Without very tedious scripting, making a fixture from an image is done by putting vectors at relatively close points to make a shape that looks similar to the image.
Further information on how to create a ChainShape
can be found here.

TheChubbyPanda
- 1,721
- 2
- 16
- 37