Version: Unity 2019.2.11f1 (64-bit)

I am creating a street 2 fighter style 2D fighting game with Unity3d.

In the process of the enemy, in the process of facing the opponent's direction, with update

// Always face the player

Vector3 pos = new Vector3 (player.transform.position.x, transform.position.y, player.transform.position.z);
transform.LookAt (pos);

The player's game object is set in player.

However, with this, if the opponent and the player overlap
It will be buzzing as if you were separated.

There is a way to prevent this from being a ghost
I couldn't think of it.

Is there any good way?

  • Answer # 1

    In the first place, I don't think there are many situations where characters overlap with each other.
    Basically, unless the technique is being activated, I think that it will be pushed against each other by the push judgment, but how about it?


  • Answer # 2

    I don't understand a little detail, but I think the problem is that the hit judgment or physics calculation occurs when the opponents overlap.
    Why not set layers so they don't interfere with each other?