Please tell me a fix

Hi a am super new to coding I am following Brackey’s tutorial to learn unity and there is error on comming in unity while working with variables. The error is titled this "
Assets\Player_movement.cs(19,24): error CS1503: Argument 1: cannot convert from ‘float’ to ‘UnityEngine.Vector3’"
and this is my code

using UnityEngine;

public class Player_movement : MonoBehaviour
    {

     public Rigidbody rb;

     public float forwardforce = 2000f;

    // FixedUpdate is used for unity ONLY!!!
    // And just to mess with physics LOL!
    void FixedUpdate()
    {
        // Add a forward force
       rb.AddForce(0, 0, forwardforce * Time.deltaTime);

       if ( Input.GetKey("d") )
       {
           rb.AddForce(500 * Time.deltaTime, 0);
       }
    }
}

The problem is you’re not using AddForce correctly. It’s telling you that it’s expecting a Vector3 and you’re passing a float.

Here’s the API docs for it: Unity - Scripting API: Rigidbody.AddForce

This means you’re not following the tutorial correctly.

Hi I just found out the error and it is patched now

1 Like