英文:
How to Change the forward vector in unity 2D
问题
我只是无法弄清楚如何在Unity中更改对象的前向矢量,请告诉我如何做,这就是我真正想知道的。
英文:
I just can't figure out how to change the forward vector of an object in unity, Please tell me how that's all I really want to know.
答案1
得分: 1
你可以使用 transform.forward
来实现这个目的。Vector3.forward
是一个静态变量(只有一个副本存在,且在所有对象之间共享),对于每个对象都是相同的。然而,transform.forward
是特定于对象的,并且会随着对象的旋转而变化。
简而言之:使用 transform.forward
而不是 Vector3.forward
。
英文:
You would use transform.forward
for that instead. Vector3.forward
is a static variable (only a single copy exists and is shared between everything) and is the same for every object. However, transform.forward
is specific to the object and changes when said object rotates.
TLDR: transform.forward
instead of Vector3.forward
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论