Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

328
Views
Recibo un error de giro, ¿pueden ayudarme a solucionarlo?

Estoy trabajando en un juego de matar zombis en 2D, pero hubo un error al girar el arma en mi código, cuando giro el arma, sale mal. ¿Me puedes ayudar?

Vídeo: https://youtu.be/8kUgXkEZc2M

Aquí está el código:

 [SerializeField] Transform _arm; float _offset = -90; Vector3 _startingSize; Vector3 _armStartingSize; public GameObject Bullet; public float BulletSpeed; public Transform ShootPoint; #region Start // Start is called before the first frame update void Start() { _startingSize = transform.localScale; _armStartingSize = _arm.localScale; } #endregion // Update is called once per frame void Update() { Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 perendicular = _arm.position - mousePos; Quaternion val = Quaternion.LookRotation(Vector3.forward, perendicular); val *= Quaternion.Euler(0, 0, _offset); _arm.rotation = val; if(transform.position.x - mousePos.x < -0.1) { transform.localScale = _startingSize; _arm.localScale = _armStartingSize; } else if(transform.position.x - mousePos.x > 0.1) { transform.localScale = new Vector3(-_startingSize.x, _startingSize.y, _startingSize.z); _arm.localScale = new Vector3(-_armStartingSize.x, -_armStartingSize.y, _armStartingSize.z); } if (Input.GetMouseButtonDown(0)) { shoot(); } } void shoot() { cineShake.Instance.ShakeCamera(5f, .1f); GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation); BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.right * BulletSpeed); }
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!