Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一些逻辑并意识到夹紧功能不能正确夹紧旋转。它总是返回我设置的最大旋转。
然后我做了另一个简单的逻辑来检查什么是错的。我知道,Clamp 函数会自动返回最大限制和最小限制。我将 Input.GetAxis("Ver") 放置在代码中,因此当轴没有输入时,值必须为零。但是钳位返回最大值是没有意义的。
可能是我对 Mathf.Clamp() 的理解是错误的。因此,我用它发布我的代码。
注意:我没有按下与轴输入相关的任何按钮。轴输入为零。我正在使用统一 3d 5.6 个人版。
您的参数顺序错误,正确的顺序是数字,最小值,最大值。Mathf.Clamp 文档