Unity的Rigidbody中有个MovePositon的接口,主要是用于移动刚体位置,但是解释里不是很清除,也没搜到详细的说明,于是就做了点测试,可能有些也不一定对。
Unity版本:2019.4.0f1
Moves the kinematic Rigidbody towardsposition
. Rigidbody.MovePosition moves a Rigidbody and complies with the interpolation settings. When Rigidbody interpolation is enabled, Rigidbody.MovePosition creates a smooth transition between frames. Unity moves a Rigidbody in eachFixedUpdate
call. Theposition
occurs in local space. Teleporting a Rigidbody from one position to another uses Rigidbody.position instead of MovePosition.
首先是文档里的说明
当在FixedUpdate里对Kinematic的刚体使用MovePosition进行移动时,如果刚体组件的interpolation属性不为None,则transform会进行刚体的位置做插值表现。