AstarPath Grid breaks normal movement of player

  • A* version: 5.2.1
  • Unity version: 2022.3.49f1

Hey all :slight_smile:
I have an issue with AStar where if I use it in the project, it breaks normal non A* star movement.
see the attached video -

My movement controller is really simple, and once I’m enabling Astar, it completely breaks it.

protected override Vector3 CalculateMovementVector()
    {
        // Get movement input from keyboard
        var verticalInput = Input.GetAxis("Vertical");  // Forward and backward (Z-axis)
        var horizontalInput = Input.GetAxis("Horizontal");  // Left and right (X-axis)

        // Calculate target movement direction based on input
        Vector3 moveDirection = transform.forward * verticalInput + transform.right * horizontalInput;

        // Normalize the movement vector to ensure diagonal movement isn't faster
        if (moveDirection.magnitude > 1)
        {
            moveDirection.Normalize();
        }

        // Apply smoothed movement to the Rigidbody
        Vector3 moveVelocity = moveDirection * _moveSpeed;
        return new Vector3(moveVelocity.x, 0, moveVelocity.z);
    }

I have this method that I use to calculate the movement vector, as you can see, im not even using A* pathfinding here, any ideas?

Hi

I see nothing obviously wrong in the video. What should I be looking for?

Are you using any pathfinding components on the player object?

Sorry, I think it was not clear enough in the video.

What im doing there is doing circular movement with the WASD, without AStarPath (which works correctly)
and then with, which then causes come absolutely randomness in the movement.
I’m not using any pathfinding components on the player object.

Also, a breakthrough, When I set the grid side to not insane values (in the video it’s 300x300)
everything is working as intended!
this is a super weird case.

No idea what could cause that. Nothing should affect your object unless it has pathfinding components.

Maybe it’s due to some difference in the FPS?