c# - Unity 中的 Quaternion.FromToRotation 出错?

标签 c# unity3d

每当我运行这段代码时,我都会遇到多个错误:

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

关于c# - Unity 中的 Quaternion.FromToRotation 出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33468238/

相关文章:

c# - 在 .NET XmlDocument 中移动 "a child up"的最佳方法是什么?

c# - 将数据从 View 绑定(bind)到 ItemsPanelTemplate

c# - 计时器不断加载场景而不是一次

c# - 如何在 C# 中将光标导航到我的二维数组中?

c# - 使用协程检测何时按下或未按下某个键?

c# - Unity Sprite 不按命令更改?

c# - C#中如何多次执行存储过程

c# - Linq - 如何选择一个新对象来包含其他对象的列表?

android - 如何将数据从 Unity 场景传递到 Android Activity

c# - 使用 OpenXml 创建 word 文档 (docx)