Jump to content
UnitySpain

XedZ

Registrados
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

2 Neutral

About XedZ

  • Rank
    Recién Llegado

Profile Information

  • Especialidad
    Coder

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePos.z = 5.23f; mousePos.x = mousePos.x - transform.position.x; mousePos.y = mousePos.y - transform.position.y; float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle)); if (mousePos.x < transform.position.x && !facingRight) { facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; } else if (mousePos.x > transform.position.x && facingRight) { facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; }
  2. Muchas gracias.Una cosa , como harias tu para darle la vuelta , lo he estado probando y al darle la vuelta parece que se invierte la cosa.
  3. public Transform controlThisObject; //Here can be the transform of the weapon private Vector3 mousePos; public Quaternion angles; public bool facingRight = true; void Update() { MouseL(); angles = transform.rotation; } void MouseL() { Vector3 mousePos = Input.mousePosition; mousePos.z = 5.23f; Vector3 gunPos = Camera.main.WorldToScreenPoint(transform.position); mousePos.x = mousePos.x - gunPos.x; mousePos.y = mousePos.y - gunPos.y; float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle)); if (transform.rotation.w <=0.7 && !facingRight) { facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; } else if (transform.rotation.w >= 0.7 && facingRight) { facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; } } Estoy intentando hacer un script en el que un arma mira al raton y que cuando gire a la izquierda cambie de horientacion.Nose si me explico bien.Pero al momento de girar a la izquierda pasan cosas raras.Muchas gracias de antemano.
  4. Hola , siento responder tan tarde , la linea 51 es: Sword = swordDatabase[selected]; Gracias de antemano.
  5. Como lo soluciono? using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Daño : MonoBehaviour { public Text dañoText; public Text velText; public Text fueText; public Text nameText; public Text Crit1Text; public Text Crit2Text; public Text EntText; public Text RotText; public Text PreText; public Text descText; public Text espText; public Espada Sword; public int selected; public List<Espada> swordDatabase = new List<Espada>(5); // Start is called before the first frame update void Start() { List<Espada> swordDatabase = GameObject.Find("Manager").GetComponent<WeaponManager>().Espadas; } // Update is called once per frame void Update() { dañoText.text = Sword.Daño.ToString (); velText.text = Sword.Vel.ToString(); fueText.text = Sword.Fue.ToString(); nameText.text = Sword.Nombre; descText.text = Sword.Desc; Crit1Text.text = Sword.CRIT1; Crit2Text.text = Sword.CRIT2; EntText.text = Sword.Entereza.ToString(); RotText.text = Sword.Rotura.ToString(); PreText.text = Sword.Presencia.ToString(); espText.text = Sword.Esp; Sword = swordDatabase[selected]; } }
×
×
  • Create New...