Unity 中 Quaternion.FromToRotation 出错?
Error with Quaternion.FromToRotation in Unity?
每当我 运行 此代码时,我都会遇到多个错误:
transform.rotation = Quaternion.FromToRotation (Vector3(0, 0, 0), Vector3(0, 0, 270));
你能建议修复此代码吗?
错误:
Expression denotes a type', where avariable', value' ormethod group' was expected
The best overloaded method match for UnityEngine.Quaternion.FromToRotation(UnityEngine.Vector3, UnityEngine.Vector3)
has some invalid arguments
Argument #1' cannot convertobject' expression to type UnityEngine.Vector3
假设您使用的是 C#,您应该使用 new Vector3()
而不是 Vector3
每当我 运行 此代码时,我都会遇到多个错误:
transform.rotation = Quaternion.FromToRotation (Vector3(0, 0, 0), Vector3(0, 0, 270));
你能建议修复此代码吗?
错误:
Expression denotes a type', where avariable', value' ormethod group' was expected
The best overloaded method match for
UnityEngine.Quaternion.FromToRotation(UnityEngine.Vector3, UnityEngine.Vector3)
has some invalid argumentsArgument #1' cannot convertobject' expression to type
UnityEngine.Vector3
假设您使用的是 C#,您应该使用 new Vector3()
而不是 Vector3