how to recognize what shapes you draw with the mouse or joystick

I am trying to make drawing a specific shape activate a power in my character, let’s say you hold down the right click or any button on the controller, and draw a circle, this makes the character launch a lightning bolt

How do I implement this system?

I would need a bit more information for what specific platform you are using to handle such a task. In essence, you would need to build an algorithm to record the player’s mouse/controller movements while the button is held down and check if the drawn shape resembles your creation.

To record the movement, you will need to use the Event Tick to capture the mouse position each frame, you would then need to know what shape to track for and have an algorithm set out for that specific shape.

Here is an example for a circle:

  1. Button activates, the recording starts, and the mouse starting location is set.
  2. Place one new point every frame or however many you think is necessary.
  3. Once the circle is complete, calculate the center distance of the circle that was written.
  4. Calculate the average distance from the center to the points.
  5. Validate if the points are within the threshold to be considered a proper circle.

You could probably do something like:

        // Center calculation
        Vector2 center = Vector2.zero;
        foreach (Vector2 point in points)
        {
            center += point;
        }
        center /= points.Count;

        // Average distance from the center to the points.
        float averageDistance = 0;
        foreach (Vector2 point in points)
        {
            averageDistance += Vector2.Distance(point, center);
        }
        averageDistance /= points.Count;

        // Check if distance is within threshold of the circle radius.
        float radiusThreshold = circleRecognitionThreshold;
        float circleRadius = 0.5f;
        if (Mathf.Abs(averageDistance - circleRadius) <= radiusThreshold)
        {
            return true;
        }

        return false;
    }

What you are asking help for is relatively complex, especially if you want to create new shapes on the fly. You should consider hiring a programmer if you would need the system fleshed out.

The truth is that it sounds quite complicated, I was hoping to be able to do something with blueprints, I will leave it unresolved and I will see if anyone has any other method, anyway, thank you very much.