What you need is a normalized direction vector (a vector with a length of 1). let directionVector = normalize(playerPosition - dummyPosition)
Now you can use this direction vector and multiply it with a number to create a velocity vector. let velocityVector = directionVector * knockbackVelocity