- Home /
Why won't my ball move in Roll - a - Ball?
In the roll - a- ball project, my ball was rolling fine then mono develop crashed. I could remember where I was in the tutorial. I re-did everything and the ball doesn't move. I've done everything I could, but to no avail. what can I do?
using UnityEngine; using System.Collections;
public class PlayerController : MonoBehaviour { public float speed; public GUIText countText; public GUIText winText; private int count;
void start()
{
count = 0;
SetCountText ();
winText.text = "";
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
// Destroy everything that enters the trigger
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText ();
}
}
void SetCountText()
{
countText.text = "Count: " + count.ToString();
if(count >= 12)
{
winText.text = "YOU WIN!";
}
}
}
here is what it looks like in unity. extreme rookie to this. please help.
Answer by Fanttum · Sep 10, 2014 at 11:25 PM
Is Kinematic is checked in the inspector. You want this to be false so the physics work out correctly. When Is Kinematic is checked it won't take in any forces, Read more about it here.
This is the correct answer. Or at least something that must be done. Have you tried it?
Answer by seaoatsgaming · Jul 11, 2017 at 02:06 AM
Monodevelop may try to "convert endings" to Windows when you type up your code. You have to select "Keep file endings"
Really? At most I get a warning from time to time about that.
Answer by TacoMakerMan · Jul 11, 2017 at 04:01 AM
You haven't added a reference to 'rigidbody' yet. Try adding
RigidBody rigidbody;
At the beginning, and then in start, add
rigidbody = GetComponent<RigidBody> ();
Yes, this as well. But still don't neglect that is$$anonymous$$inematic cannot be true for the ball.
I know, just no-one had mentioned this, and the answer talking about if is$$anonymous$$inematic had been checked for the ball had not been marked as the answer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613162734im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Raycast chase player, avoid walls.. raycast detailed C# tutorial? 0 Answers
Making a Tutorial in th emiddle of screen and more efficiant 1 Answer
Easy simple way to create a networking between 2 computers using bluetooth 2 Answers
SimpleMove details (3D platform tutorial problems) 0 Answers
Funky Glowing Things 1 Answer