Hello
I tried different approaches as seen in below code. I want the object to move backwards from my player when he gets to near.
The backing away does work, but as i get more and more near the object starts to actually penetrate the floor and after sjort while he will go through the floor.
I have colliders and rigidbody setup…
Please advice…
rb.AddForce(-transform.forward * 50f * Time.deltaTime);
rb.velocity = new Vector3(rb.velocity.x, rb.velocity.y, rb.velocity.z * -backSpeed * Time.deltaTime);
this.transform.position = Vector3.MoveTowards(this.transform.position, target.position, -backSpeed * Time.deltaTime);