I wanna rotate my object around an edge object but it doesnt stop. its x rotation reach 180 and move on like -179, -178… and make a circle like this. But I want to rotate it up to 45 degrees and back to 0 degrees again in a loop.

here is my code part ;

obj.transform.RotateAround(edgePoint.transform.position, vec, 20 * Time.deltaTime);

You normally need to change the pivot point in a 3D modelling application to have your model to rotate around a certain point.

Alternatively, in Unity you can create an empty game object and position it at the point you want to rotate around and then make the object you want to rotate a child of the new empty object. Now rotate the parent object using Quaternion.Lerp or if you want to use euler angles there is a solution here How can I lerp an objects rotation? - Questions & Answers - Unity Discussions

Edit: The link wasn’t intended as a full answer but to direct you to information to piece together a solution yourself. I have included a more direct solution below.

```
IEnumerator LerpRotation(Vector3 rotationAmount, float duration)
{
print("Start");
float time = 0;
Vector3 startRotation = transform.rotation.eulerAngles;
Vector3 targetRotation = startRotation + rotationAmount;
while (time < duration)
{
print(Vector3.Lerp(startRotation, targetRotation, time / duration));
transform.rotation = Quaternion.Euler(Vector3.Lerp(startRotation, targetRotation, time / duration));
time += Time.deltaTime;
yield return null;
}
time = 0;
while (time < duration)
{
transform.rotation = Quaternion.Euler(Vector3.Lerp(targetRotation, startRotation, time / duration));
time += Time.deltaTime;
yield return null;
}
transform.position = startRotation;
print("End");
}
```

This can be started using

```
StartCoroutine(LerpRotation(new Vector3(0, 45, 0), 1));
```

@DrTomato the link you shared is just about rotating an object from current rotation to a value. It doesnt work in a loop. " I want to rotate it up to 45 degrees and back to 0 degrees again in a loop. "