Kinematic rigidbody has slight friction as if physics are being used but I don't want that

Hi all. I’m stumped on this behavior that I’m experiencing. I’m using the following code to move my player’s rigidbody (which is set to Kinematic)

 public bool TryMove(Vector2 direction, out Vector2 moveVector)
        {
            moveVector = Vector2.zero;
            int count = rb.Cast(direction,
                MovementFilter,
                castCollisions,
                MoveSpeed * Time.fixedDeltaTime + CollisionOffset);

            if (count == 0)
            {
                moveVector = direction * MoveSpeed * Time.fixedDeltaTime;
                rb.MovePosition(transform.position + (Vector3)moveVector);
                return true;
            } 
}

The direction vector comes from reading keyboard inputs (WASD). But whenever I start pressing the keys to move my player, there is a very slight delay as if there is some friction preventing the player from picking up speed immediately. When I stop pressing the keys, there is a similar delay before the player comes to a stop as if it has momentum. From reading the docs it seems like my approach to movement should not include any physics so I am stumped as to why this is occurring. I thought at first I was imagining the slight delays but my partner independently observed the same thing.

You are using the physics system so it cannot use anything else but physics.

There’s no friction or anything on a Kinematic Rigidbody2D. There’s no collision response at all, that’s the point of it.

The delay isn’t the physics engine so it’ll be something in your scripts. When you call MovePosition, it doesn’t happen there and then though, it’ll happen when the simulation runs as does everything involving movement in the physics engine. So when do you have the simulation running? During fixed-update? If so, it happens then.

Also, as a note, you shouldn’t refer to the Transform.position; that is not the authority on position, the Rigidbody2D is as it writes to the Transform. You should always refer to Rigidbody2D.position. This is especially true if you’re using interpolation as they won’t be the same thing. Interpolation is the act of moving the Transform from the previous Rigidbody2D position to the current Rigidbody2D position. Also, interpolation happens over the (potentially) several frames in-between fixed-updates. The body is immediately at the new position though after the simulation runs if you request it to “MovePosition”.

Ok, thanks for the heads up on the transform.position thing.

My TryMove method is being called in Update. I’ll try profiling my code to see if maybe somthing is causing the delay. Thanks!