Jump to content
UnitySpain

Search the Community

Showing results for tags 'construcion'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Inicio
    • Proyectos
    • Offtopic
    • Unity Feeds
    • Website
  • Mesa de ayuda
    • Unity
    • Arte
    • Otras Especialidades
    • Builds & Dispositivos
  • Aportes de la Comunidad
    • Recursos
    • Eventos
    • Buenas Prácticas
  • Bolsa de trabajo & Colaboraciones
    • Ofertas y Demandas
  • Post Antiguos
    • General (Antiguo)

Blogs

  • byGui
  • El Blog de Pioj

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Especialidad

Found 1 result

  1. Hola tengo una duda y es por que al no quitarle la colision al objecto el objecto viene hacia mi al apuntar al suelo el video para que se entienda mas y el codigo abajo https://www.youtube.com/watch?v=IXUsKMsBsn8&amp;feature=youtu.be using System.Collections; using System.Collections.Generic; using UnityEngine; public class constr : MonoBehaviour { public GameObject fogata; Vector3 targetPosition; public bool construir = false; public bool mostar = false; public GameObject obejc; public float rotate = 0.0f; public float altura = 0.0f; public float altu_defautl = 0.0f; public float rotate_2 = 0.0f; public int contador = 0; public bool tocar = false; public Collider payer; void Start() { targetPosition = transform.position; } void Update() { if (Input.GetKey(KeyCode.R) && mostar) { rotate += 0.45f; obejc.GetComponent<Transform>().eulerAngles = new Vector3(obejc.transform.rotation.x, rotate, obejc.transform.rotation.z); } if (Input.GetKey(KeyCode.T) && mostar && !tocar) { contador++; if (contador == 0) rotate = 45.0f; if (contador == 1) rotate = 90.0f; if (contador == 2) rotate = 135.0f; if (contador == 3) rotate = 180.0f; if (contador == 4) rotate = 225.0f; if (contador == 5) rotate = 270.0f; if (contador == 6) rotate = 315.0f; if (contador == 7) rotate = 360.0f; if (contador == 8) { rotate = 0.0f; contador = -1; } tocar = true; Invoke("toqui", 0.25f); obejc.GetComponent<Transform>().eulerAngles = new Vector3(obejc.transform.rotation.x, rotate, obejc.transform.rotation.z); } if (Input.GetKey(KeyCode.Alpha1)) { altura = 0.0f; Destroy(obejc); rotate = 0f; mostar = true; rotate = fogata.transform.rotation.y; obejc = Instantiate(fogata, targetPosition, fogata.transform.rotation); sacar_coli(obejc); } if (Input.GetMouseButtonDown(0) && mostar == true) { construir = true; } if (Input.GetMouseButton(1) && mostar == true) { mostar = false; Destroy(obejc); } if (mostar) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 7f)) { targetPosition = hit.point; altu_defautl = hit.point.y; if (Input.GetAxis("Mouse ScrollWheel") < 0f) { altura += 0.01f; } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { altura -= 0.01f; } altu_defautl -= altura; targetPosition.y = altu_defautl; obejc.transform.position = targetPosition; if (construir) { GameObject asd; asd = Instantiate(obejc, obejc.transform.position, obejc.transform.rotation); poner_coli(asd); Destroy(obejc); construir = false; mostar = false; } } } } void toqui() { tocar = false; } void sacar_coli(GameObject obj) { Collider[] col = obj.GetComponents<Collider>(); for (int i = 0; i < col.Length; i++) { col[i].enabled = false; } } void poner_coli(GameObject obj) { Collider[] col = obj.GetComponents<Collider>(); for (int i = 0; i < col.Length; i++) { col[i].enabled = true; } } }
×
×
  • Create New...