How to drag an object along a path using touch controls in specific areas?

Hello I’m new to unity and coding in general. I am more of an artist then a programer but I’m giving it a shot anyway. Also I’m new to the questions board so if I got this in the wrong place, I’ll try to fix it.

My problem is that I want to touch and drag anywhere on one side of the screen, to move a specific object up and down along a path. Wile rotating the object along the way. And then do the same on the other side of the screen. I’ve looked for tutorials but can’t seem to find anything. Also I’m coding for android in the Unity 2d aspect if that makes a difference.

I made an illustration showing what I’m after.

Any explanations or links to tutorials on the subject would be helpful.
Thank you for reading.

Some clarity on the question.

The character stays stationary in the center of the screen wile bullets fly at him/her.
There are two shields that rotate around the character in an ark but don’t go all the way around the character.
There are menus at the top and bottom of the screen that define the area that bullets fly.

current layout of game so far.

Here is a bit code that solves it for a mouse. I leave it up to you to convert it to touch. To work, you have to set things up in a particular way.

  • Create an empty game object a the center of the ship. Name it ‘Right’
  • Place the right shield directly to the right of the ship at the correct distance
  • Make the shield a child of the empty ‘Right’ game object
  • Attach the script below to the empty parent named ‘Right’
  • Duplicate the ‘Right’ game object which will also duplicate the child shield. Name the new parent object ‘left’
  • Select the game object now named ‘Left’ and uncheck the ‘isRight’ variable in the Inspector
  • Set the rotation for the ‘Left’ game object to 180.0

Hit play, and hold the mouse button down to move the shields.

Note I added a bit of easing with respect to rotation. That way when a finger is first pressed down, or a mouse is first clicked, the shield does not immediately snap to the angle, but visibly rotates to the angle. If you don’t what that, directly assign the result of the AngleAxis() call to transform.rotation. Also if you did not get it from the steps above, if the parent empty game object for each shield has rotation (0,0,0), then the shield for both would be on the right.

#pragma strict

public var isRight : boolean = true;
public var speed = 180.0;

function Update () {
	if (Input.GetMouseButton(0)) {
		var onRight = (Input.mousePosition.x > Screen.width / 2);
		if (isRight && onRight || !isRight && !onRight) {
			var pos = Camera.main.WorldToScreenPoint(transform.position);
			var dir = Input.mousePosition - pos;
			var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
			var targetRot = Quaternion.AngleAxis(angle, Vector3.forward);
			transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRot, Time.deltaTime * speed); 

P.S. I just took a closer look at your diagram. Given the arc you are looking for, the empty ‘Left’ and ‘Right’ game objects need to be places at the center of the circle formed by that arc, not at the center of the ship.