我有一个 Vector3,其中包含有关世界空间中 gameOjects 位置的信息,我想知道是否可以查询 x 和 y 组件以查看它是否已更改?
提前为您的帮助喝彩
您可以随时使用 查询对象的位置gameObject.transform.position,这将为您提供在世界空间中的位置。如果将该位置保存到变量中,则可以检查它在下一帧中是否以及如何更改:
Vector3 oldPosition; // the Vector you want to compare to
Vector3 delta = transform.position - oldPosition;
// delta now contains how much the position has changed since oldPosition