1. 程式人生 > >Unity物體移動的方法總結

Unity物體移動的方法總結

  1. 其一,如果引數3為負數一直反方向遠離
 cube.transform.position = Vector3.MoveTowards(cube.transform.position, new Vector3(10, 10, 10), -Time.deltaTime * 8f);
  1. 其二
	//rigidbody2D.MovePosition(Vector2.MoveTowards(transform.position, transform.position + CurrentAspect, Time.deltaTime * 4));
  1. 其三
	rigidbody2D.velocity = currentAspect;
  1. 其四
	transform.Translate()