Stuck with Roll A Ball..
HI completely new to this so forgive my ignorance!
i've followed the guide step by step and rechecked and can't find where I've gone wrong.. The ball will not move at all and tells me I have a parsing error.
Please point me in the right direction.. below is my script
using UnityEngine; using System.Collections;
public class PlayerController : MonoBehaviour {
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 );
}
Edit your question, highlight the code and format it using the 101010 button. You should see an error message in the console that says where your parsing error is. Copy the message into your question here. Double click on the message in the console and it will take you to the offending line of code. Tell us what that line is too.
Refer to the FAQ and User Guide for information on writing better questions and including the information people need in order to be able to help you.
Answer by saintshenanigans · Apr 08, 2016 at 06:57 PM
I'm not too experienced with coding yet, but following the tutorial code, it looks like you missed the speed variable. The completed script has you declare speed:
public float speed;
and then has you multiply it by movement
rb.AddForce (movement * speed);
for the tutorials, you can usually find the completed script below the video for reference.