All Questions


Sergio Candela Ramírez
posted to: Bumpers (solution)

how does the number of vertex on the polygon affect the performance?

I dont get why use only a few vertex. does it matter? Can we add more points in order to "draw" the mushroom shape better? I guess this is not important as this CollisionShape is not the most reliable (As said on the previous comment) Thank you for your time!
  • Nathan Lovato replied

    Sure, you can use more points. The main reason I use few points is because we have to draw and manage every vertex by hand in Godot.

    There is another option I didn't show you: if you select a sprite, a menu appears in the toolbar that allows you to generate a CollisionPolygon2D as a sibling. It will trace the sprite. But the resulting shape may not be round and smooth, causing some collision issues in game.

  • Nathan Lovato replied

    Oh and regarding performances, without measuring it, I couldn't say. The rule of thumb is to use the vertices you need, and to keep the collision shapes simple. We'd have to make a demo and measurements to see how costly they are.

    But note you don't need a perfectly round collision shape for the slope to feel round for the player. In all games, the collision space is much simpler than what you see.

  • C
    Sergio Candela Ramírez replied

    Thanks, Nathan