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 语言中不存在向后。任何其他方式我怎么能改变而不是前进回去? 提前谢谢大家
试试这个。也许可以解决问题:)
movePlatform.transform.position -= transform.forward * Time.deltaTime *8;