Why I have these errors CS0119, CS1502, CS1503 ?

Assets/Scripts/PlayerController.cs(17,29): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected
Assets/Scripts/PlayerController.cs(17,20): error CS1502: The best overloaded method match for UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3)' has some invalid arguments Assets/Scripts/PlayerController.cs(17,20): error CS1503: Argument #1’ cannot convert object' expression to type UnityEngine.Vector3’

errors CS0119, CS1502, CS1503

I am new in unity 3d,
I’ll glade to understand why I have these errors
My simple code:

using UnityEngine;
using System.Collections;



public class PlayerController : MonoBehaviour {

        public 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(Vector3);
    }
}

here, rb.AddForce(Vector3);

I guess you meant rb.AddForce(movement);

1 Like

Many Thanks the errors are gone.