Godot Version
v4.5.1
Question
I am trying to set up a simple platformer for learning purposes. I have a player (CharacterBody2D), a platform (StaticBody2D), and then a bell (RigidBody2D, set up as a PinJoint2D).
When the player runs into the bell, I want there to be a collision with it. However, my player script currently uses move_and_slide(). I am trying to figure out what the most idiomatic Godot way is of making the player collide with the bell whilst still sliding on the platform.
I’ve asked various AI’s about this, and they seem to recommend using get_slide_collision_count(), etc. However, this all seems a bit too “manual”. I would have to apply force to the bell myself, which feels counter-intuitive.
If I have another CharacterBody2D where I just do position.x += delta * 10, and I make it move into the bell, the collision happens beautifully and “automatically”.
Another idea was to use move_and_collide(velocity * delta), but then that interferes with the sliding on the platform.
What is the best way to do this?
