Hi,
I have a tank game and want to make the controll for mobile like a click on the terrain and move the tank there. The tank has 3 axes and Wheelcolliders.
I already tried several things but allways run in the problem with different terrain heights.
As long as the terrain is flat it is no problem to move the tank, but if there is a small or then the tank get’s a strange behavior.
IEnumerator MoveToPosition()
{
yield return null;
while(Vector3.Distance(transform.position, target) > 3 ) {
if(Vector3.Distance(transform.position, target)>3)
{
transform.LookAt(target);
Debug.Log (Vector3.Distance(transform.position, target));
}
rb.MovePosition(transform.position + transform.forward * 10 * Time.deltaTime);
yield return null;
}
MoveToTarget= false;
yield return null;
}