Question by
Alxis11 · Sep 08, 2017 at 07:51 PM ·
roll a ball
Roll a Ball wont roll
Hello - I have been trying to get this ball to roll but it just won't roll... I have beenfollowing the tutorial for more than eight times now...
This is my code - I don't even get the speed component on my player
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);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612134441im_/https://answers.unity.com/themes/thub/images/avi.jpg)