MovePosition - Bug

Hello
I have a problem When I use MovePosition. this is my code :

transform.Rotate(0, Input.GetAxisRaw("Mouse X") * sensibility, 0);

       
        directionMove = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        directionMove = transform.TransformDirection(directionMove);
        directionMove *= personnageSpeed;

        player.MovePosition(directionMove);

When I start the game with this, my player move well but it stop to x or y or z = 5 (personnageSpeed = 5). When I don’t press the keys, my player come back to 0 0 0 without any reason.

So I can do everything I want, my player will not move far and it will come back when I release the key to move …

Can someone help me please ???

You’re currently telling your player to move to a specific position, not adding an offset.

Try adding this line before MovePosition:
“directionMove += player.position”

1 Like