Object moves jerkily

Hi!

I am making a simple 2,5 space shoter. I have noticed a strange behavior when moving an object: the object dont moves smoothly and do some jerks every 1-2 seconds.

The code what I am using for moving the object is:

  public float speed;
  private Rigidbody rb;
    void Start()
    {
         rb = GetComponent<Rigidbody>();
         rb.velocity = transform.right * speed;
    }

I tried to move the object like that:

  public float speed;
  private Rigidbody rb;
     void Start()
     {
          rb = GetComponent<Rigidbody>();
     }
     void Update()
    {
          rb.transform.Translate(transform.right * Time.deltaTime * speed);

    }

But the object still moves jerkly.

Setting off the Vsinc and using interpolate on the rigidbody make the move smoothly, but still doing jerks.

Any solution to fix that problem?

Thanks in advance.

Hi, normally using the rigid body with a collider to make collisions and moving the object by code creates some weird results, you need to check if the Is Kinematic is disabled, some times this generate some frictions between coded movements and physics movements, if that is the case, enable it, cheers.

Try putting the movement code in FixedUpdate instead of Update