如何在Unity 2D中更改前向矢量

huangapple go评论73阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年7月13日 17:48:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76678051.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定