Hey everyone! I’ve been working on an enemy for my third-person combat-based game.
I’ve created an enemy that moves towards the player when detected, and when it reaches the player, performs a simple attack for now.
However, I’ve noticed that when the enemy is moving and the player is in the way, the enemy pushes the player, applying force to the player.
In the above case, only the player has a ‘rigid body’, but the enemy does not. What I would like to happen is the player does not get pushed when the enemy’s collider interacts with the player’s capsule collider.
For instance, in this video from God of War, we see that neither the enemy nor the player can move the other around when in contact (unless it is specifically an interaction with the other such as dealing a blow)
Also, when the player runs into the enemy, the enemy does not get pushed, this is how I’d like my enemy to behave with the player as well.
What’s worked so far: based on what I’ve looked up, I used a ‘rigid body’ on the enemy with mass as 5 (the player has it as 50) and it has since made the push less apparent, however, I’m not very satisfied with this result and now the player can push the enemy around too.
So, I was wondering if there’s a standard approach to this that developers generally use that I’m not aware of, where on collision, there is no physics interaction other than a physical barrier to the each other’s ‘game object’ instead of one pushing the other.
Is there anything else here? Or is my approach to this problematic in the first place? I would greatly appreciate any input on this, thanks!!