Forces arent being applied as expected

Hi, Im trying to get the force of an explosion to effect objects less the further they are from the center of the explosion. For some reason the method that im using dosent seem to have any impact of how far the objects seem to move in a way that I would expect, hopefuly im just missing something obvious and its a simple fix. Everything that is involved with the process is under “Void Knockback()”. Any help or suggestions would be appeciated, thanks.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Explosivehealthmanager : MonoBehaviour
{
    private Rigidbody2D rb;

    public float currenthealth, maxhealth, effectscale;

    public float radius, force;

    public GameObject deatheffect;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        currenthealth = maxhealth;
    }

    void FixedUpdate()
    {
        if (currenthealth <= 0)
        {
            Knockback();

            if (deatheffect != null)
            {
                var hitVFX = Instantiate(deatheffect, rb.transform.position, rb.transform.rotation) as GameObject;
                hitVFX.transform.localScale = new Vector3(effectscale, effectscale, effectscale);
                Destroy(gameObject);
            }

            else
                Destroy(gameObject);
        }
    }


    void Knockback()
    {
        Collider2D[] objects = Physics2D.OverlapCircleAll(transform.position, radius);

        foreach (Collider2D obj in objects)
        {
            
            float distance = (Vector2.Distance(obj.transform.position, transform.position));
            Vector2 direction = obj.transform.position - transform.position;
            float forcemulti = force * 1/distance;
            Debug.Log(obj.name);
            Debug.Log(forcemulti);

            if (forcemulti < Mathf.Infinity)
            {
                obj.GetComponent<Rigidbody2D>().AddForce((direction * forcemulti));
            }
        }
    }
}

You are running into problems with the force being applied for a very short amount of time (namely a single frame).

You probably want to use ForceMode2D.Impulse mode as a second parameter to the AddForce call. Unity - Scripting API: ForceMode2D.Impulse

I am actually not sure how it handles time exactly. But you will probably want to divide your force by Time.deltaTime to keep the result independent of the frame rate. But I am not sure, because I haven’t dealt with forces in Unity for a while. Maybe that’s what the Impulse mode does.

[edit] found this https://forum.unity.com/threads/difference-between-forcemode2d-force-and-forcemode2d-impulse.649858/