How do I use Vector3 with rigidbody.Addforce

I am not quite sure how to phrase the question but I tried my best. Alright, I have my function to go forward, bla bla bla. The real problem I am getting from this script is the inability to move my character the direction it is pointed to. Here is my line
Distance is a variable btw,
rigidbody.Addforce(Vector3.forward*distance*Time.deltaTime)
I have tried this aswell…
rigidbody.Addforce(Vector3(0,0,distance) and this does work except it only moves in the position that was set in the beginning, or in other words, when I rotate it, it doesn’t go in the direction it is facing, any ideas on how I could, move it in the direction it is facing.

I’m a complete newbie with JavaScript and I would like to know, so I can finally get my character moving properly

Thanks in advanced :D.

Problem is Vector3 is constant of value (0, 0, 1), meaning it doesn’t change, ever. That makes you move along the Z axis only. Same with Vector3(0,0,distance).

Use transform.forward instead. You’ll still need a way to rotate though.

You should use a multiple of transform.forward, which is your object’s forward vector.

You shouldn’t use Time.deltaTime with forces - they are applied continuously over the course of the frame, so Unity does this multiplication for you under the hood. You also shouldn’t use a distance as the magnitude of the force - they’re different physical quantities. To begin with just try this:

rigidbody.AddForce(transform.forward)

and multiply it by something if you want it to move faster/slower.