Hello, Im tryin unity for the forst time and I started with making Roll-a-ball project acording official tutorial. I stacked at moving the ball... using UnityEngine; using System.Collections; public class PlayerController: MonoBehaviour { public Rigidbody playerRigidBody; void Fixedupdate () { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical); playerRigidBody.AddForce (movement); } } The ball doesnt move... pls help
As above you havent assined Rigidbodyplayer a value. So at the moment you are asking addforce to use Rigidbodyplayer as a ridigidbody without calling the component for Rigidbody. Try entering this code above FixedUpdate() << don't forget to caps the U in update Code (csharp): void Start() { playerRigidBody = GetComponent<RigidBody>(); } Hopefully this will fix your issue.
No. He is using a public declaration. ( which just determines a memory placeholder for a variable) I asked how/where he was assigning a value to that field.
Also for the tutorials that the learn team put up there is Q&A threads under the teaching section made for each specific tutorial. Makes it alot easier for the tutors to find posts related to their tutorials have a look over at the RollABall Q&A thread if need further info. http://forum.unity3d.com/threads/roll-a-ball-tutorial-q-a.319451/