Beginner's mistakes

Hello Unity Forum. I have just started using the Unity tutorials and (yes) am stuck on the first game I’m trying to make. It’s the Rollaball game. Every time I finish writing the coding for the controls and save the file I get an error message in Unity that says
Assets/Scripts/PlayerController.cs(13,27): error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)’

Iv’e been over my coding a dozen times. This is what it looks like this -

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour
{
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis(“Horizontal”);
float moveVertical = Input.GetAxis(“Vertical”);

Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

Rigidbody.AddForce(Vector3);
}
}

I can’t find my mistake. Can someone please, pleeeaaaase help me out?
Thanks in advance
-RoofPizza

First of all this belongs in Scripting, not Gossip.

Second, when posting code please use code tags.

Third, use rigidbody instead of Rigidbody (note the capitalization).

Rigidbody is the class while rigidbody is the instance of the class.

2 Likes

Fourth, what are you hoping to accomplish with “rigidbody.AddForce(Vector3)”? Vector3 is a type name, it has no value. Did you mean “rigidbody.AddForce(movement)”?