how to make Vector3.MoveTowards accept physics

hi, i need to make my G.O change position between 2 vectors but the problem is that he ignoring physics, i want him to stop if he collided with any other object, any ideas? thnx :slight_smile:

If you want to use physics, you should probably be moving the character with physics. Try Rigidbody.AddForce or AddRelativeForce.

Add this after the *if (Physics.Raycast(ray, out hit, Mathf.Infinity, myLayerMask))* check.


        if (Input.GetMouseButtonDown(0)){
if (Physics.Linecast (transform.position, target.position,hitInfo)){
//movement code here , tell it to move to hitInfo.point
}
else
//tell it to move to target.position
}