user3636645
user3636645

Reputation: 41

Unity C# - Rigidbody.AddForce not working as intended

So, I am trying to make a cube move with the WSAD buttons and for some reason, even though I am not touching any buttons, it moves diagonally up and to the left. I am using Unity 4.5.1

Code:

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {
    public float moveSpeed;
    private Vector3 input;

    // Use this for initialization
    void Start () {
    }

    // Update is called once per frame
    void Update () {
        input = new Vector3(Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
        print(input); 
    }
}

Upvotes: 0

Views: 1216

Answers (1)

spaghettifunk
spaghettifunk

Reputation: 2014

Your problem may be somewhere else, because the code seems just fine. If I were you, I'd try to take a look to this page. You might find the solution to this issue

Upvotes: 1

Related Questions