Hello everybody, first post ever here sorry to bother you all.
Im the worst when it comes to programming, im a proffesional artist but this is new for me so, if im asking something really stupid please forgive me. So my question:

-How can I make a object (rigidbody2D, Staticbody2D, Animatablebody2D) or ANYTHING push another (rigidbody2D) like a hammer, like a plunger from a pinball. If anybody can give me a working GDScript of something that resembles a pinball plunger I will make it worth for you. I have found tutorials of Character2D using _force against objects but never a non playable character pushing other stuffs and I feel is something so basic im gonna lose my mind.

I have tried so many thing and im sure the answer is stupid so here are the things I tried and didnt work:
-Making an animated body2D that just moves fast or changes possitions very fast without /code (this doesnt work, both objects interact but there is no force applied from 1 object to the other, no matter how heavy is one respect to the other, no matter friction...)
-Making a Rigidbody2D and moving it changing its possition with /code (this also doesnt work, both objects interact but the force applied from 1 object to the other is either to low or absurd to the point of glitching)
-Making a Rigidbody2D with a child Area2D that triggers like a hurtbox on area_entered (this doesnt work because move_and_slide is not a thing in scripting anything thats not Character2D)

Thank You again and have a good day

    Pepechi -How can I make a object (rigidbody2D, Staticbody2D, Animatablebody2D) or ANYTHING push another (rigidbody2D) like a hammer, like a plunger from a pinball. If anybody can give me a working GDScript of something that resembles a pinball plunger I will make it worth for you. I have found tutorials of Character2D using _force against objects but never a non playable character pushing other stuffs and I feel is something so basic im gonna lose my mind.

    you put them in different collision layers.
    the "hammer" is in layer, lets say 5. on the other hand the "ball" is in layer 4, but it monitors layer 5.
    so when the ball is hit with an object in layer 5 it will be moved, but when it collides with the hammer, the hammer will not move.

      Jesusemora
      Hi, thank you for your reply. The problem still remains that I don't have a good way to apply a regular 'push' force on demand with a script or similar control. Any push force or move_and_slide tutorial I found on the internet is for a Character2D script either performing the pushing or receiving it. I feel that it's so basic for bodies or entities to apply knockback-like force to anything (not just the player) that I must be missing something.

        Pepechi move_and_slide is with Character.
        The other physics object is RigidBody and has the impulse methods

        void apply_central_impulse ( Vector2 impulse=Vector2(0, 0) )

        Applies a directional impulse without affecting rotation.

        An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).

        This is equivalent to using apply_impulse at the body's center of mass.

        what are you trying to push? a RigidBody is a physics object and can be applied an initial force. a Character is a kinematic body and moves every frame. in that case you have to manually calculate the force and apply it every frame for a time.

        
        var timer : float = 0.0
        var timer_max : float = 1.0#apply force for 1 second
        var speed : float = 200
        
        func physics_process(delta) -> void:
             if timer < timer_max:
                  timer += delta
                  velocity.y = speed * delta#set velocity to 200 for 1 second
                  #alternatively we can calculate drag and start at 200 and slow down over time
                  #velocity.y -= drag * delta
        
        func apply_force_character_y() -> void:
             timer = 0.0#start timer