Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to move an object away from others with same tag by a certain amount?

Discussion in 'Physics' started by Konxovar, Jun 8, 2023.

  1. Konxovar


    Dec 1, 2019
    I'm trying to create a "board game" type thing in Unity 2D, and I would like each player to be visible within the same space, and the way I want to do that is by having it so when a player collides with another player, which will happen when it enters the same space, it is pushed away from the other player by a certain amount to make it visible and not completely overlap, because the players use the same sprites and are the same size.
    I've tried to do this myself, but I end up pushing both the player I want to stay and the player I want to be pushed, and I'm not sure what to do. I'm a novice, so help would be appreciated, thank you.