Объект не двигается к другому но код по моему правильный;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class PLAYER1 : MonoBehaviour
{
public GameObject goal1;
public GameObject goal2;
bool check = false;
void Update()
{
if(check) transform.position = Vector3.MoveTowards(transform.position, goal1.transform.position, 2f * Time.deltaTime);
if(!check) transform.position = Vector3.MoveTowards(transform.position, goal2.transform.position, 2f * Time.deltaTime);
transform.rotation *= Quaternion.Euler(0f,0f,1f);
}
}
-
Вопрос задан
-
42 просмотра