8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

未找到 .next/static/index.html'(2:没有此文件或目录),NextJs 在 plesk 服务器上部署

Jashvita 2月前

47 0

好的,我做了一些学习的东西,我需要我的电梯停几秒钟 private IEnumerator ReversePlatform() { Yield return new WaitForSeconds(2); _AccuTime = 0...

好的,我做了一些学习工作,我需要让电梯停几秒钟

   private IEnumerator ReversePlatform()
    {
        yield return new WaitForSeconds(2); 
        _AccuTime = 0;
        speed = -speed;
    }

我在这里打电话,我的电梯就开始摇晃并上升,它们不会下降

        if (_AccuTime > _RunTime)
        {
            StartCoroutine("ReversePlatform");
        }
        else 
        {
            transform.Translate(0, speed * Time.deltaTime, 0);
        }

我需要它们上升,停留大约 2 秒,然后持续下降

帖子版权声明 1、本帖标题:未找到 .next/static/index.html'(2:没有此文件或目录),NextJs 在 plesk 服务器上部署
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Jashvita在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 我需要它们上升,停留大约 2 秒,然后持续下降

    和重复协程 Update 总是有点奇怪

    [Tooltip("Where to move to (worldspace)")]
    [SerializeField] 
    private Vector3 targetPosition;
    
    [Tooltip("How fast to move (unit/s)")]
    [SerializeField] 
    private float moveSpeed;
    
    [Tooltip("How long to wait on the start/end positions")]
    [SerializeField] 
    private float delay = 2f;
    
    private Vector3 startPosition;
    
    private IEnumerator Start()
    {
        startPosition = transform.position;
    
        // This is totally fine for a Coroutine as long as you ensure you yield
        while(true)
        {
            // move to target with given speed
            yield return MoveTowards(transform, targetPosition, moveSpeed);
    
            // wait for delay
            yield return new WaitForSeconds(delay);
    
            // move back to start with given speed
            yield return MoveTowards(transform, startPosition, moveSpeed);
    
            // wait for delay
            yield return new WaitForSeconds(delay);
        }
    }
    
    private static IEnumerator MoveTowards(Transform transform, Vector3 target, float moveSpeed)
    {
        // Vector3 == uses approximation with precision 1e-5
        while(transform.position != target)
        {
            // every iteration moves one step towards the target without overshooting
            transform.position = Vector3.MoveTowards(transform.position, target, moveSpeed * Time.deltaTime);
    
            // "pauses" the coroutine, let Unity render this frame
            // and continue from here in the next frame
            yield return null;
        }
     
        // to end with clean values
        transform.position = target;
    }
    

    注意:如果你想在本地空间移动,只需将所有内容交换 transform.position transform.localPosition

返回
作者最近主题: