0
我將以下腳本附加到我想控制葫蘆GO的GO上。升降機應該移動到目標位置,但最終會轉移到GO,而我必須附加腳本。這是什麼原因造成的,我該如何解決?爲什麼我的遊戲對象移動到錯誤的地方?
using UnityEngine;
using System.Collections;
public class HoistTest : MonoBehaviour
{
public GameObject hoist;
public Transform target;
public float speed;
void OnMouseUp()
{
float step = speed * Time.deltaTime;
hoist.transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}
}
你完全正確。不能相信我錯過了那個。謝謝您的幫助! – mnr