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

215
Views
Cómo hacer que un cuerpo rígido 2D se mueva en unidad

Soy bastante nuevo en C# y Unity y estoy tratando de hacer un salto cuadrado con un Vector2 pero, por alguna razón, el cuadrado no se mueve. Aquí está el código para que lo veas:

 using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float Jump; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { Jump = Input.GetAxis("Jump"); if (Jump == 1) { new Vector2(0, 1); } } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

prueba esto

 //player must have a rigidbody2D and a box colider public float moveSpeed = 5f; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { Jump(); Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f); transform.position += movement * Time.deltaTime * moveSpeed; } void Jump() { if (Input.GetButtonDown("Jump")) { gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse); } }
over 4 years ago · Santiago Trujillo Report
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!