Am trying to make 2 falling stars.
When player hit a trigger area, the star move with some speed (- some aceleration).
the stars are 2 planes with materials (particles/alpha blended multiply) and trail renderer
here is the code
using UnityEngine;
using System.Collections;
public class control_cometa : MonoBehaviour {
public GameObject cometa_estela;
public bool movimiento=false;
/*public float p_mov_x=1;
public float p_mov_y=1;*/
public float velocidad=10f;
public float desaceleracion=2f;
// Use this for initialization
void Start () {
cometa_estela.gameObject.active = false;
}
// Update is called once per frame
void Update () {
if(movimiento){
cometa_estela.transform.Translate(Vector3.left * velocidad);
velocidad -= desaceleracion;
if(velocidad<0){
movimiento=false;
Destroy (cometa_estela);
Destroy (gameObject);
}
}
}
void OnTriggerEnter( Collider colison ){
if( colison.gameObject.tag == "jugador" ){
if(!movimiento){
//Debug.Log("mov");
cometa_estela.gameObject.active = true;
//StartCoroutine(mover_cometa());
movimiento=true;
}
}
}
}
The result is this:
please show me how to see my star