hi, I am trying to make a new game ( similar to the Roll a Ball tutorial game but with more features, different materials colours etc.) anyway, I was trying to write the script to move the player when I ran into a problem, i was writing this :
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
private Rigidbody rb;
public float speed;
void Start ()
{
rb = GetComponent<Rigidbody> ();
}
void FixedUpdate ()
{
float movehorizontal = Input.GetAxis ("Horizontal");
float movevertical = Input.GetAxis ("Vertical");
Vector3 = new Vector3 (movehorizontal, 0.0f, movevertical);
rb.AddForce (movement * speed);
}
}
just incase what i suspect the problem is doesnt show, the problem is that movement is underlined red in the line rb.AddForce (movement * speed);
im not sure is this is what the problem is but there isnt anything to help me out in the footer of the unity page im working on, it only says " All complier errors have to be fixed befor you can enter playmode "
please help me, sorry if i sound really desperate, im not that desperate, i would just really like to know how to fix my problem as im out of ideas, as far as i know, evrythings how it should be. by the way, im aware that this script isnt the best, nor is it compleate, just saying in advance…
thanks in advance for the help,
-Reece