I'm trying to get my characters near to each other so they can attack the other one, but when the player character or otherwise gets near they are pushed to the other direction when they collide. How to prevent that happen so they won't move when touching each other?

This is the player objects: player configs in unity

The Treant objects: treant configs in unity

I what I want is that they collide and can't move through each other and stop moving. But this keep happen: gif of my treant getting pushed away

Can someone help me with this issue?


2 Answers 2


If you don't want collisions to be able to push your objects, you can make them Kinematic (Under Rigidbody 2D -> Body Type -> Kinematic)

This tells the Physics engine "I will take responsibility for this object's movement, including dealing with collisions, so you don't have to push this object around to solve penetration"

The trick is that then you actually have to take that responsibility. If you just teleport one object into another one by setting its position, the physics engine won't intervene to stop you or push them apart, because you told it you'd handle that part.

Instead you'll want to use methods like MovePosition to move up to, but not through, the next collision, or use shapecast queries to check how far you can move your character in open space before you actually move them there


Fixed by removing rigidbody from the Treant and change from kinematics to dynamics in the rigidbody from Player.

There is an explanation of what does the colliders in Unity API

Player colliding in a monster and hitting them

  • 1
    \$\begingroup\$ Wouldn't either removing rigidbody from treant OR setting the rigidbody of player to kinematic work just as well? The Trenat could use a rigidbody when it comes to stuff such as interactions with spells or arrows or such. \$\endgroup\$
    – rtgher
    Commented Jan 29, 2020 at 13:48
  • \$\begingroup\$ I had to add Rigidbody to Treant and using Kinematic woked well. My issue was that I was changing to kinematics in the player rigidbody. Changing in the Treant solved the issue. Thanks. \$\endgroup\$ Commented Jan 31, 2020 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .