Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Temas - Miguel Torrealba

#1
Estoy haciendo una animacion En donde un un objeto ataca a otro (Animacion) , entonces el objeto que es atacado se supone que cuando colisiona con el objeto que lo ataca Se produce otra animacion.Pero he hay donde surge el problema, cuando Hice el script de colision con el otro personaje Hice la prueba de colision y fue todo bien, Entonces cuando agregue al script las cosas del animator para que hiciera las transiciones pasa algo raro en el juego , se supone que en el juego hay un carro que se mueve pero cuando le agrego el componente animator se detiene osea no se translada , y entonces en el inspector cuando quito el componente animator si se mueve, y entonces revise para ver que habia hecho mal y vi que todo estaba bien en el codigo.En resumen el problema es que cuando pongo el componente animator a funcionar se reproducen las animaciones pero el carro no se mueve se queda parado,Alguien que por favor me ayude con este problema por favor. P.D El carro tiene el componente Rigidbody con gravedad 0 , y el objeto que lo ataca tiene un box colider y lo marque como is trigger y al caro tambienEspero Que puedan ayudarme gracias.........  
#2
 Hola , Alguien me dice como hago para emparentar gameobjects mediante un script ( o si existe alguna funcion para eso ) ,lo que quiero es que cuando un objeto colisione con otro en la jerarquia salgan emparentados , osea que de 2 pasen a 1 .P.D Necesito una explicacion detallada sobre esta funcion transform.parent  ya que cada vez que la utilizo la consola me da un error, y no lo entiendo bien. .Si se necesitan el script se los dare.
#3
General (Antiguo) / Problemas con script de puerta y llave
Septiembre 02, 2015, 07:41:54 AM
He estado creando en estos dias un script para una puerta y una llave, pero tengo un problema que el script no reconoce cual es la llave correcta , asi que cuando agarro una llave se habren todas y no identifica cual es cual, son 2 script uno de la llave y otro de la puerta.
 
 
 
Codigo LLave
 

using UnityEngine;
using System.Collections;
public class LlavesScript : MonoBehaviour {
    public AudioClip SonidoRecogerLlave;
    
    // Use this for initialization
    void Start () {
    }
    
    // Update is called once per frame
    void OnTriggerStay (Collider other) {
        if (other.tag == "Player") 
        {
                Debug.Log("Click para recoger");
                {
                        if (Input.GetMouseButton())
                        {
                            NotificationCenter.DefaultCenter().PostNotification(this,"llaveRecogida");
                            AudioSource.PlayClipAtPoint(SonidoRecogerLlave,transform.position);
                            Debug.Log ("Tienes la llave");
                        }
                }
        }
    }
}

 
Codigo puerta
 

using UnityEngine;
using System.Collections;
public class PuertaScript : MonoBehaviour {
    private float AngleY = 90.0f;    
    
    private float targetValue = 0.0f;
    private float currentValue = 0.0f;
    private float easing = 0.05f;
    public bool Abierta = false;
    public bool tieneLlave = false;
    public AudioClip sonidoPuertaCerrada;
    public AudioClip sonidoPuertaAbierta;
    public GameObject Target;  //bisagra
    public GameObject llave;
    public string nombre;
    void Start ()
    {
        NotificationCenter.DefaultCenter().AddObserver(this,"llaveRecogida");
    }
    
    void  Update (){
        
        
        currentValue = currentValue + (targetValue - currentValue) * easing;
        Target.transform.rotation = Quaternion.identity; // set rotation to zero
        Target.transform.Rotate(, currentValue, ); // apply full Rotation
        if (Input.GetMouseButton ()) {
                        Debug.Log ("click");
                }
    
        if (targetValue == AngleY && currentValue == ) {tieneLlave =false;}
        
    }
    void OnTriggerStay (Collider other){
    
                        if (Abierta == false) {
                                if (other.gameObject.tag == "Player" && tieneLlave) {
                                        if (Input.GetMouseButtonDown ()) {
                                                targetValue = AngleY;
                                                currentValue = ;
                                                Abierta = true;
                                                audio.clip = sonidoPuertaAbierta;
                                                audio.loop = false;
                                                audio.Play (); 
                                
                                        }
                                }
                        }
                
       if (other.gameObject.tag == "Player" && !tieneLlave) {
            if (Input.GetMouseButtonDown()){
                        Debug.Log ("ESTA CERRADO");
                        audio.clip = sonidoPuertaCerrada;
                        audio.loop = false;
                        audio.Play ();     
                }
            if (Abierta){
                targetValue = ;
                currentValue = ;
                }
        }
        }
    void llaveRecogida (Notification notificacion){
    
                if (llave.name == "Llave1") {
                        tieneLlave = true;
        }  
        }
}

 
ya intente todo lo que se Ayuda por favor!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#4
General (Antiguo) / Prolemas con script de puerta y llave
Septiembre 02, 2015, 07:09:48 AM
He estado creando en estos dias un script para una puerta y una llave, pero tengo un problema que el script no reconoce cual es la llave correcta , asi que cuando agarro una llave se habren todas y no identifica cual es cual, son 2 script uno de la llave y otro de la puerta. Codigo LLave
using UnityEngine;
using System.Collections;public class LlavesScript : MonoBehaviour {    public AudioClip SonidoRecogerLlave;
        // Use this for initialization
    void Start () {    }
    
    // Update is called once per frame
    void OnTriggerStay (Collider other) {        if (other.tag == "Player") 
        {
                Debug.Log("Click para recoger");
                {
                        if (Input.GetMouseButton(0))
                        {
                            NotificationCenter.DefaultCenter().PostNotification(this,"llaveRecogida");
                            AudioSource.PlayClipAtPoint(SonidoRecogerLlave,transform.position);
                            Debug.Log ("Tienes la llave");
                        }
                }
        }
    }
} Codigo puertausing UnityEngine;
using System.Collections;public class PuertaScript : MonoBehaviour {    private float AngleY = 90.0f;    
    
    private float targetValue = 0.0f;
    private float currentValue = 0.0f;
    private float easing = 0.05f;    public bool Abierta = false;
    public bool tieneLlave = false;    public AudioClip sonidoPuertaCerrada;
    public AudioClip sonidoPuertaAbierta;    public GameObject Target;  //bisagra    public GameObject llave;
    public string nombre;    void Start ()
    {
        NotificationCenter.DefaultCenter().AddObserver(this,"llaveRecogida");
    }
    
    void  Update (){
        
        
        currentValue = currentValue + (targetValue - currentValue) * easing;
        Target.transform.rotation = Quaternion.identity; // set rotation to zero
        Target.transform.Rotate(0, currentValue, 0); // apply full Rotation        if (Input.GetMouseButton (0)) {
                        Debug.Log ("click");
                }
    
        if (targetValue == AngleY && currentValue == 0) {tieneLlave =false;}
        
    }    void OnTriggerStay (Collider other){
    
                        if (Abierta == false) {
                                if (other.gameObject.tag == "Player" && tieneLlave) {
                                        if (Input.GetMouseButtonDown (0)) {
                                                targetValue = AngleY;
                                                currentValue = 0;
                                                Abierta = true;
                                                audio.clip = sonidoPuertaAbierta;
                                                audio.loop = false;
                                                audio.Play (); 
                                
                                        }
                                }                        }
                
       if (other.gameObject.tag == "Player" && !tieneLlave) {
            if (Input.GetMouseButtonDown(0)){
                        Debug.Log ("ESTA CERRADO");
                        audio.clip = sonidoPuertaCerrada;
                        audio.loop = false;
                        audio.Play ();     
                }            if (Abierta){
                targetValue = 0;
                currentValue = 0;
                }
        }        }    void llaveRecogida (Notification notificacion){
    
                if (llave.name == "Llave1") {
                        tieneLlave = true;
        }  
        }
}   ya intente todo lo que se Ayuda por favor!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!