Godot Version
4.2.2
Question
For a simple plinko style game where you have balls that fall down and bounce of pegs what is the best way to handle collisions and detecting them?
Right now, for the ball I just have a RigidBody2D with a CollisionShape2D and a Sprite2D.
The pegs are a StaticBody2D with the collision shape and sprite.
That works fine for the physics but when I tried to detect when the ball hits a peg (so I could have the peg do a small visual effect) I couldn’t get the body entered signal to emit.
I found out I have to enable contact monitoring and set a max contact. I did that and gave the peg a function and called the function from the ball using body from the body entered signal.
I plan on having tons of balls and pegs in the game, so I want to make sure this is the right way to do it instead of finding out later that it’s wasting a bunch of resources on things it doesn’t need to.
Is this a fine way to do it or should I be using Area2Ds or CharacterBody2Ds or some other way of detecting collisions? Or should I have the collision detection on the pegs instead of the balls?
And how do max collisions work? Does it mean max collisions at one time? Like if the ball was touching two pegs but max collisions was at 1 it would only detect one peg? Or is it just how many collision events it keeps in memory?