I’ve just started learning Unity and I don’t know what’s going on cause when I write the script and press Play, everything works fine but the sphere keeps flying. The position of the sphere is how it’s taught in the video (x: 0, y:0.5, z:0) but when I click play It changes y=1. Can anybody help me?
Here is the script
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);
}
}