Roll a Ball tutorial: Ball doesn't move
I don't know what's wrong, for everything seems correct. However, my ball just doesn't move no matter what :( I even tried to move it only forward using transformation.forward and still it didn't move. I would appreciate if anyone help me.
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
have you gave a value to speed & attached this script to the ball
Your answer
![](https://koobas.hobune.stream/wayback/20220612075150im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Loot table problems 1 Answer
Rotation script issue? 2 Answers
Game crashes on iPhone 11 0 Answers
Play animation 10 seconds, after play other animation 1 Answer
Need help with Mute Button 1 Answer