【问题标题】:Trying to make a Gorilla Tag movement system尝试制作 Gorilla Tag 运动系统
【发布时间】:2022-10-07 13:37:25
【问题描述】:

我正在尝试制作大猩猩标签移动系统,但出现错误:

GetDrag does not exist in the current context

我的代码只写了一个简单的“float GetDrag()”。

我正在看这个视频教程:https://www.youtube.com/watch?v=5D2bN7xL5us&t=1s

  • edit您的问题以显示您的代码。该错误意味着无法从您尝试调用它的位置访问 GetDrag 方法。这可能有多种原因,例如它可能是您试图从声明它的类外部调用的私有方法。显示方法声明位置与您尝试调用它的位置之间关系的代码对于能够回答问题至关重要。

标签: c# unity3d 3d virtual-reality


【解决方案1】:

做这个

float GetDrag()
     {
         Vector3 handVelocity = (target.localPosition - 
         _previousPosition) / Time.fixedDeltaTime;
         float drag = 1 / handVelocity.magnitude + 0.01f;
         drag = drag > 1 ? 1 : drag;
         drag = drag < 0.03f ? 0.03f : drag;
         _previousPosition = transform.position;
         return drag;
     }

【讨论】:

    【解决方案2】:

    大猩猩标签的创建者在 MIT 许可下开源了运动代码

    https://github.com/Another-Axiom/GorillaLocomotion

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-11
      • 1970-01-01
      • 1970-01-01
      • 2010-10-14
      • 2019-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多