# How to calculate the real position after rotate with a original point without using Transform in 2D game

Now I get the original point’s position, direction and the angle with 2 object. And I want to physics2D.CircleCastAll to hit some object. So I want to get the real position from some script. Please Help>"< and thankyou

I don’t quite understand what you are asking with physics2d.circlecastall, but the from the picture:

Vector3 RotatePointAroundPoint(Vector3 point1, Vector3 point2, float angle)
{
var x = Mathf.Cos(angle) * (point1.x - point2.x) - Mathf.Sin(angle) * (point1.y - point2.y) + point2.x;
var y = Mathf.Sin(angle) * (point1.x - point2.x) + Mathf.Cos(angle) * (point1.y - point2.y) + point2.y;
return new Vector3(x,y);
}

You can use this to rotate a point around another point by a certain amount of degrees. Your picture looks like the small object is rotating 120 degrees clockwise (negative) around the big object. So you can use the function like this:

newPosition = RotatePointAroundPoint(oldPosition, otherPosition, -120f);

If you just want to continually rotate around you would use the delta angle or rotation like this:

void Update()
{
// Rotate -90 degrees per second (negative for clockwise)
var rotateBy = -90f * Time.deltaTime;
newPosition = RotatePointAroundPoint(oldPosition, otherPosition, rotateBy);
}

Ok, after finally seeing your code I think I know what you want now. You T, P, and O to remain in that triangle formation as it rotates (toward target) around the object? This is what I got:

void Update()
{
Vector3 dir = (target.position - transform.position).normalized;
float angle = getAngle(transform.position, target.position);

Vector3 clusterPosition = dir * 5f + transform.position;
clusterPosition = RotatePointAroundPoint(clusterPosition, transform.position, angle);
var angleDir = Quaternion.Euler(new Vector3(0f, 0f, angle * Mathf.Rad2Deg - 90f));

T.position = clusterPosition + angleDir * a;
P.position = clusterPosition + angleDir * b;
O.position = clusterPosition + angleDir * c;
}

float getAngle(Vector2 me, Vector2 target)
{
return Mathf.Atan2(target.y - me.y, target.x - me.x);
}

I had to modify your getAngle function, the rotate function is unchanged.