I'm creating a 2D platformer in MonoGame and I'm thinking of using AABB as physical colliders for characters and then have a trigger polygon collider on each character for checking for example if an enemy's weapon is touching the player, making it more precise. The polygon collider is animated so every frame in every animation has its own points. That's a lot of work. Is that precision needed? What is usually done in this situation?
1 Answer
Updating a primitive collider position is already costly, polygon colliders are really expensive by definitnion, i only use it for static objects, changing a polygon collider position is really expensive. And on top ot that changing a polygon collider actual polygon.? Its probably not a good idea, you could try but i dont thinl you will succeed. Most people use primitive colliders next to each other to fake a more complex geometry.
-
\$\begingroup\$ So, should I have an AABB for physical collisions and then some primitive trigger colliders for character collision testing that get updated depending on the animation and frame of the animation? \$\endgroup\$– MartinJun 23, 2017 at 14:46
-
\$\begingroup\$ Yes, i wouod do that! \$\endgroup\$ Jun 23, 2017 at 14:48
-
\$\begingroup\$ If you decide to try the polygon collider editing in runtime solution, let me know your results! \$\endgroup\$ Jun 23, 2017 at 14:49
-
\$\begingroup\$ I don't think the performance results will be visible with just a handful of characters, but if you have tons of them in the same level the framerate might drop, but I don't know, maybe my PC is too good to be slowed down by a 2D platformer under (almost) any circumstance. The performance of a polygon collider depends on the amount of points and I try to keep it low (5-8). \$\endgroup\$– MartinJun 23, 2017 at 15:00
-
\$\begingroup\$ But maybe the collision is not really accurate. Anyways, i wanna know it :D \$\endgroup\$ Jun 23, 2017 at 15:07