Boa noite! Estou Iniciando nenhuma Desenvolvimento de hum Jogo mas Estou tendão Alguns Problemas referentes a Movimentação de Objetos Alguns, na qua se adicionar o script de um caminhão Algum OU Avião na qua defini determinados Pontos that ELE PODE SE APENAS motor vai de ré. Já o Usuário se locomove corretamente. Scripts utilizados não Caso do Avião: Se alguém puder me auxiliar ficarei grato. Atenciosamente
using UnityEngine;
using System.Collections;
public class aviao : MonoBehaviour {
private GameObject voando;
// Update is called once per frame
void Update () {
if(!Globais.wayTrocas){
voando = GameObject.Find (“a1”);
transform.LookAt (voando.transform);
transform.Translate (0f,0f,(float)15*Time.deltaTime);
Debug.DrawLine (voando.transform.position,transform.position,Color.blue);
}
else
{
voando = GameObject.Find (“a2”);
transform.LookAt (voando.transform);
transform.Translate (0f,0f,(float)15*Time.deltaTime);
Debug.DrawLine (voando.transform.position,transform.position,Color.red);
}
}
}
using UnityEngine;
using System.Collections;
public class a2 : MonoBehaviour {
public void OnTriggerEnter(Collider other)
{
Globais.wayTrocas = false;
}}
using UnityEngine;
using System.Collections;
public class a1 : MonoBehaviour {
public void OnTriggerEnter(Collider other)
{
Globais.wayTrocas = true;
}
}
using UnityEngine;
using System.Collections;
public class Globais : MonoBehaviour {
public static bool wayTrocas= false;
}