# I have added a force of 500 and an if statement if the press a certain key they will move a certain way but it does not move I know why it does not but there is another problem.

using UnityEngine;

``````public class PlayerMovement : MonoBehaviour
{

public Rigidbody rb;

public float forwardForce = 2000f;

// Update is called once per frame
void FixedUpdate()
{
rb.AddForce(0, 0, 0 * Time.deltaTime); // Time.deltaTime evens the speed depending on the framerate.

if ( Input.GetKey("d") )
{
}

if ( Input.GetKey("a") )
{
}
}
}
``````

(Read the header and then read this line) There is a problem where my cube does not move I know that my variable forward Force is conflicting with my if statements but when I fix that my 500 force is hardly pushing I have a physics material which makes the friction of the ground but I checked the dynamic force is 0 and the static friction is 0 but it still moves very slowly. I’m a beginner following a tutorial.

First things first:

You don’t need to multiply velocity by Time.(fixed)deltaTime.

Adjusting for framerate is important for the resulting position, but you don’t need to (and shouldn’t) apply that to the velocity itself. Because you’re calling Time.deltaTime in FixedUpdate(), it (by default) is multiplying the value by 0.02f (50 physics updates per second). In other words, the force you’re attempting to apply is likely 10 units/second acceleration, divided by mass. Likewise, your “forwardForce” variable could be scaled down to a relative 40.

That matter doesn't necessarily explain why it's not moving, however, so let's try covering a few bases here:
``````Vector3 playerInput;

void Update()
{
// Input is read during Update(), so
// this is the most reliable place to check it
playerInput = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
}

void FixedUpdate()
{
// This ForceMode ignores mass, which would often be
// preferred for player-driven input
}
``````

Additionally, you mention that you’re moving a cube around; with the way PhysX handles friction between colliders, this should mean that you have two primary points of contact and potentially a lot more friction beyond that. If you JUST changed the friction, but not the “Friction Combine” of it in your PhysicMaterial (i.e. still using the average friction), then it will still put up a large amount of resistance toward that initial motion (static friction).

I think you need to add ForceMode.Impulse
like this

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

if ( Input.GetKey("a") )
{
rb.AddForce(-500 * Time.deltaTime, 0, 0, ForceMode.Impulse);
}
``````

I am sorry I wasted your time because I had a constraint set on the x axis. I was testing constraints out and I accidently left the x axis on for position

But still my friction combine by default was “Average” so should I change that?

I am confused about whether I need to add ForceMode.Impulse or ForceMode.Acceleration