Why is my quad not moving in sync with its collider?

I thought this might be due to an error in a custom controller I’m programming, but the problem still occurs when I try moving a Quad object with a BoxCollider2D component using a very simple script:

using UnityEngine;

public class Test: MonoBehaviour 
{
    private float speed = 1.5f;

	private void Update()
    {
        float velocity = Input.GetAxisRaw("Horizontal") * speed * Time.deltaTime;
        transform.Translate(new Vector2(velocity, 0));
	}
}

Here’s a screenshot of the issue: Imgur: The magic of the Internet

As you can see, the BoxCollider2D and Quad mesh are not moving together. I have no idea why this is happening, but hopefully I’m just overlooking something.

Can you try using FixedUpdate() instead (as a test)? I have a feeling you won’t see that issue.


I think problems can occur when using 2D colliders with 3D objects (a quad is 3D). You should just use a standard box collider here. Or, if you are making something 2D, just a simple square sprite instead of the quad.