Hi, I am using the movement script from the roll a ball tutorial, but as soon as I start the game my dart backs off the canvas all by itself.
Here’s the code I’m using;
using UnityEngine;
using System.Collections;
public class PlayerMovement : 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);
}
}
Also, I want to use the arrow keys to move the dart left and right only, where would I need to put that script? In a new C# script or somewhere in this one possibly?
Any help would be totally appreciated Thanks