2D Physics , throw force , push force issue HELP

Hi, I have this game and an enemy is supposed to charge (Like a bull) at my Player and throw him in the direction the bull charges, but, I cant seem to manage …

This is the code :

private void FixedUpdate()
    {
        if (ElkMovementSCR.CanCharge && CollidedWith_Lek && !SPRREn.flipX)
        {

            myRigidBody.AddRelativeForce(Vector3.forward * 20);


        }
        if (ElkMovementSCR.CanCharge && CollidedWith_Lek && SPRREn.flipX)
        {

            myRigidBody.AddRelativeForce(Vector3.forward * 20);

          
        }

    }

The condition works as I tested with a bool to see if thats the issue and its not

The first picture shows what happens right now and the second is what I want to achieve:


So it does not do anything to player?
Are you sure myRigidBody is the player?
If the player is facing the elk then forward would move the player into the elk.
You could check elk’s velocity at the time but that might fail you as it collides with the player’s collider and stops but you could store the elk’s movement direction in a number of ways then use that to find how you should apply force.

It doesnt do anything to the player I checked everything, I will provide a video in a moment so you can better see what is happening

https://www.youtube.com/watch?v=tXHtlq_Mfg8
Check this video maybe you can figure the problem :frowning:

Ensure myRigidBody is in fact your player’s rigidbody.
Have to put logs in where you are applying the pushback force to make sure you are in fact getting there.

Then when you know you are applying force you would have to apply force based on the elk’s facing, for instance if the elk’s velocity on the x axis is positive that would mean the player’s applied force x is negative or vice versa as per your example; and added force on the y axis to get the lift you want. I would imagine as well that it would be a one time application of force that would have to negate any force by that elk for a duration and likely should count as a hit by the elk to inform it to stop and rethink what to do next.

You are right , I will try to do as you said and come with a response