Knockback Collision Help

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to add a wall collide feature to my knockback system, but every time the enemy collides with the wall they get flung.
    2022-07-14 18-48-29

  2. What is the issue? After enemy gets knocked back and hits a wall they get flung

  3. What solutions have you tried so far? I’ve tried to add a ray cast to the back of the lookvector for the Enemy Root part and tried to add a disable fling script if it detects a wall but it only works sometimes

My Code:
KnockBack Velocity:

Raycast and Anti fling

Don’t set the max force to math.huge and in addition body velocity is deprecated.