none
Unity 2D Movement doesnt work RRS feed

  • Frage

  • using UnityEngine;
    
    public class Movement3 : MonoBehaviour
    {
    
        public Rigidbody2D rb;
    
        public float forwardForce = 2000f;
    
        // Update is called once per frame
        void FixedUpdate()
        {
            if (Input.GetKey("a"))
            {
                rb.AddForce(10, 0);
            }
    
            if (Input.GetKey("d"))
            {
                rb.AddForce(-10, 0);
            }
    
            if (Input.GetKey("space"))
            {
                rb.AddForce(0, 50);
            }
    
        }
    }

    I worked out this code but it doesnt work and i dont know why

    Freitag, 19. Oktober 2018 18:09