Push off the enemy player which is a kinematic body node

Godot Version

3.6

Question

Hey guys,
I am trying to program this mechanic where I can push the enemy player. It’s something how a bull would fight. I just couldn’t figure out the collision and that “pushing” mechanic thing. This is the script, I know it is terrible but I really appreciate your help!

var mousepos:Vector2
var difference
var velocity
var speed = 0.05

func _ready():
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)


func _input(event):
	
	var direction = Vector3.ZERO
	if event is InputEventMouseMotion:
		direction.x += event.relative.x
		direction.z += event.relative.y
	velocity = move_and_slide(direction)
	var fast = (abs(velocity.x)+abs(velocity.z))/2
	for index in get_slide_count():
		var collision := get_slide_collision(index)
		var body := collision.collider
		if body.name == "enemy" and fast >= 7:
			print("Hit")
			$"../enemy".direction.x += direction.x
			$"../enemy".direction.z += direction.z
			$"../enemy".move_and_slide($"../enemy".direction*0.1)
			
		else:
			print ("Weak")
	fast = 0
	#move_and_slide(velocity)
	
	

func _physics_process(delta):
	if velocity != Vector3.ZERO:
		rotation.y = lerp_angle(rotation.y, atan2(-velocity.x, -velocity.z), delta / speed)
	

So, a couple of questions,

First:
Is there a reason you are doing your movement i _input, rather than physics?

Second:
If you arent able to figure out the collision you could set an area node that is just barely larger than the collision, and use body_entered/exited to set the velocity of the pushed enemy to equal the players.