# How To Rotate a two point around main circle??

i m working on 2d game

when i m press left then both point rotate in left , when i m press right then both point rotate in right??still not rotate??

i want to rotate a object clock wise??

``````public class LeftRight : MonoBehaviour
{
float movespeed = 5f;

public GameObject Firstcircle;
public GameObject Secondcircle;

void FixedUpdate()
{

if (Input.GetKey(KeyCode.LeftArrow))
{
transform.Rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Horizontal") * movespeed);
Debug.Log("moveleft");
}

if (Input.GetKey(KeyCode.RightArrow))
{
transform.Rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Horizontal") * movespeed);
Debug.Log("moveright");
}
}
}
``````

You question is not easy to read. Your code indicates a beginner level of development, which tends to lend itself to not knowing how to phrase questions.

If you are saying you want game objects to rotate around a point, then you should lookup transform.RotateAround. If you are saying your code will operate counter clockwise, and not clockwise, then I would start by cleaning up the if statements.

For instance, you are using two different input methods to gather left/right movement. I would remove Input.GetAxis(“Horizontal”) from your equation. For right, you could use Vector3.back instead of Vector3.forward, or multiply by -1. I.e. we already know from the if statement that it is a keyboard key we are reacting to.

Additionally, you could replace the entire FixedUpdate code with this to get the same results:

``````transform.rotate(Vector3.forward * Time.deltaTime * Input.GetAxis("Horizontal") * movespeed);
``````

However, it seems like you want FirstCircle and SecondCircle to rotate aroudn the object. Your question is not easy to follow. Here is what I think the translated question would be:

You should also not be using FixedUpdate, but just Update for the method. FixedUpdate is typically meant for physics modifications.