Rotate around obsolete - missing Rotate overloads???

On Unity 2019.3 I get the comment to replace transform.rotatearound with transform.rotate, but I don’t think any of the 6 overloads allow me to do the following: Rotate object 1 around object 2 by an angle on the Y-axis only. How would you re-write the following using transform.Rotate?

obj1.transform.RotateAround(obj2.transform.position, Vector3.up, 90); 

I’m starting to get pretty annoyed with the amount of stuff unity is making obsolete for no seemingly good reason. What was so bad about rotate around?

Well, RotateAround is not black magic. You can simply create your own method like this:

public static class TransformExt
{
    public static void RotateAroundPoint(this Transform aTrans, Vector3 aPoint, Vector3 aAxis, float aAngle)
    {
        var dir = aTrans.position - aPoint;
        var q = Quaternion.AngleAxis(aAngle, aAxis) ;
        aTrans.position = aPoint + q * dir;
        aTrans.rotation = q * aTrans.rotation;
    }
}

Put that class somewhere in your project and you can use it just like RotateAround. So if you have a Transform called obj1 you can do

obj1.RotateAroundPoint(obj2.transform.position, Vector3.up, 90);

However keep in mind that any kind of relative rotation of the worldspace position of an object can result in a slight drift over time. I wouldn’t recommend using such an approach. Based on your comment you seem to have a really strange approach. Why is your camera / obj2 a child of obj1 if you want to move / rotate obj1 as if it’s a child of obj2? Such a strange relationship will cause additional issues with jitter and precision. If you do a single instant 90° rotation it’s probably not that of an issue. However it’s still a really strange approach.

Since you talk in abstract terms like obj1, obj2 and we don’t know the relative orientation of the objects nor the purpose of the rotation we can’t really suggest suitable alternatives. We don’t play the guessing game here.

@gp1234567
When Unity makes something obsolete is generally because there is already a function (or another mean) that does the job for you. In this case, you can child the object you want to rotate to the object you want to be the pivot point, and then rotate the parent object.

If you don’t want your parent object to rotate, then make an empty object and repeat.

In any case, RotateAround has been obsolete since… 2013? It does not look like they will replace it any time soon.

Thanks for the reply Tripleganger. Sadly, obj2 is the main vr camera, which I CANNOT rotate. It’s is, however, already a child of obj1. So the only way to actually rotate object 2, is in fact to rotate obj1 around it, which is what I’m using this call for.

Somehow, creating extra objects, parenting them, then rotating them, then unparenting them and, possibly, having to destroy them again, seems a lot of work to replace what is in fact just an already tested and existing calculation? Any better options?