Is there a function out there, that does this:

1.Its not RotateAround, or maybe I’m stupid.

I have a point “a” in world coords, and some point “b” , some distance away.

What I want to do is this:
grab “b” and make it orbit around “a”. Not about some axis of “a”.
Like circular motion.
Actually exactly like circular motion.
I have dabbled for a long time with RotateAround, but no matter what I do, “b” rotates about some empty space constantly away from “a”. This is not what I wanted, I wanted “b” to maintain its distance from “a” and go in circles around “a”.
I tried “a”.transform.right (pseudo code) , a bunch of other stuff. But no matter what, “b” rotated about some empty point and not in circles around a. So what function should I rather use for this?
I took a look at Rotate(), and it would work perfectly if not for the Space.World / Self
field.
Is there some way that instead of Space.something I could just tell it that the axes should be relevant to “a”? This is because “a” is also on the move!
thanks :slight_smile:

I hate to tell you you’re stupid, but what you’re describing is exactly what RotateAround() does.

using UnityEngine;
using System.Collections;

public class RotateAround : MonoBehaviour {
	
	public Transform thingToRotateAround;
	private float rotationSpeed = 60; // Degrees/sec

void Start() {
	transform.parent = thingToRotateAround;		
}

	void Update () {
      transform.RotateAround (thingToRotateAround.position, Vector3.up, rotationSpeed * Time.deltaTime);
    }
}

The bit I suspect you might be missing is that in addition to rotating around “a”, you should also make “b” a child of “a” so that it inherits its movement (that’s the bit you described as a “grabbing” b).

You may find this video helpful… i cannot give you a function though D:.