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.