Transform   放在Update

transform.Translate();

----------------------------------------------------------------------------

Rigidbody. 物理放在FixedUpdate

addfroce ---vehicle like movement with slow build up of speed。车辆一样的运动,慢慢积累速度

rb.AddForce();

 

velocity

Veter2 move;

rb.velocity= new Veter2(move.x*speed*Time.deltaTime,rb.velocity.y);

rb.velocity= new Veter2(move.x*speed*Time.deltaTime,move.y*speed*Time.deltaTime);=rb.velocity=move*speed*Time.deltaTime;

 

MovePosition 

rb.MovePosition(rb.position+(move*speed*Time.delaTime));

 

注意点:

Gravity does not work with MovePosition ----Velocity is reset to Zero every function call

Moveposition does not take friction into account---Moveposition不考虑摩擦力

 

when to use movepositon over velocity

- want to move on x and y axis. ---想要在x轴和y轴上移动
- do not need friction               ---不需要摩擦
- do not have a need for gravity---不需要重力
- want collision detection         ---想要碰撞检测