My ranged attack solution

private void ProcessDirectMovement()
{
float h = Input.GetAxis(“Horizontal”);
float v = Input.GetAxis(“Vertical”);

	// calculate camera relative direction to move:
	Vector3 cameraForward = Vector3.Scale(Camera.main.transform.forward, new Vector3(1, 0, 1)).normalized;
	Vector3 movement = v * cameraForward + h * Camera.main.transform.right;

	thirdPersonCharacter.Move(movement, false, false);
	clickPoint = cameraRaycaster.hit.point;
	switch (cameraRaycaster.currentLayerHit) {
	case Layer.Enemy:
		currentDestination = ShortDestination (clickPoint, attackMoveStopRadius);
		WalkToDestination();
		break;

	}
}

when you hover cursor on enemy player setting its destination with it for preparing range attack.

Privacy & Terms