title: Move a GameObject inches back (Left/Right/Back) after its been hit?
body: <p>I am using rigidbody with <code>isKinematic = true</code> and box collider with <code>isTrigger = true</code>. After the object collides with another, i move the object few inches behind from the collision. Is there a better way to achieve this using normalization? Such that it automatically calculates the distance from the GameObject to the Box Collider it collided with, and puts the user behind it. As sometimes x values needs to be changed and sometimes its z, also the values could be negative. What I have done is only a quick fix and does not work as implemented if the values are in negative.</p>
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEngine;
  
  public class CollisionDetector : MonoBehaviour
  {
      public GameObject PlayerPos;
  
  
      public void OnTriggerEnter(Collider col)
      {
          if(col.gameObject.tag == &quot;CollideWithCam&quot;)
      {
          Debug.Log(&quot;HIT&quot;);
          StartCoroutine(MoveBack());
      }
      }
  
      IEnumerator MoveBack()
      {
          yield return new WaitForSeconds(0.1f);
          PlayerPos.transform.position = new Vector3(PlayerPos.transform.position.x-1f, PlayerPos.transform.position.y, PlayerPos.transform.position.z-1f);
      }
  }
  </code></pre>