I recently started the Space Shooter tutorial and am now on the part with player movement. For some reason whenever I hit play the ship careens to the right and I can’t figure out the problem.
Here is my code:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public Rigidbody rb;
public float speed;
void Start() {
rb = GetComponent<Rigidbody>();
}
void FixedUpdate() {
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.velocity = movement * speed * Time.deltaTime;
}
}
And my player settings:
Thank you in advance