Hey Guys. I am new to Unity, so apologies if this is very Simple. I have followed the tutorial up to Part 2 of 8, and the ball will not move at all for some reason. I have restarted unity, and deleted the game and made a new one, which, also does not work, and has the same issue. I am perplexed as I have spent a week trying to troubleshoot, but to no avail. My code is verbatim of the tutorials, as it was copy/pasted from the box below. Gravity does work by lifting the player, then beginning the game, which results in it dropping back to rest upon the plane. When I inserted the script into VisualBasic, no errors appeared. However, upon re-opening VisualBasic, a line endings error appeared, which I then pressed the fix button. Here is my code:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
private Rigidbody rb;
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.AddForce(movement * speed);
}
}
Thank you!