- A* version: 5.2.1
- Unity version: 2022.3.49f1
Hey all
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?