而不是 transform.forward 更改为“back”

问题描述 投票:0回答:1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Stay : MonoBehaviour
{
    public GameObject movePlatform;
    private void OnTriggerStay()
    {
     
        movePlatform.transform.position +=  transform.forward *  Time.deltaTime *8;
    }
}

你好,我有这段代码,我试图让我的物体向相反的方向移动,而不是向前。我尝试在“movePlatform.transform.position += transform.forward * Time.deltaTime *8;”行中搜索不同的东西,但任何东西都适合。 unity 和c 语言中不存在向后。任何其他方式我怎么能改变而不是前进回去? 提前谢谢大家

java c# unity3d unityscript
1个回答
1
投票

试试这个。也许可以解决问题:)

movePlatform.transform.position -=  transform.forward *  Time.deltaTime *8;
© www.soinside.com 2019 - 2024. All rights reserved.