Getting the angle from Transform.RotateAround

Good day,

I’m using Transform.RotateAround to rotate several smaller Stars, around a bigger Star, in a multiple Star System. In order to allow editing any of the smaller Star components, I’d set their initial (speed01 * Time.deltaTime) to = 0, and return it to its initial value after I leave selection of said smaller Star.

The problem arises when trying to limit this edit, to the currently selected Star object, which is a child object inside the bigger Star prefab. Changing the speed will apply the value to any smaller Star type, in all Star systems with multiple Stars, and said Star component enabled.

So, to make a long story short: is there a way to calculate the “angle” of Transform.RotateAround?

See the code snippet inisde the update block:

        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast (ray, out hit, Mathf.Infinity) && compSelected == false) {
            if (hit.collider == this.component01.collider) {
                component01.GetComponent<Renderer> ().material.color = Color.blue;
            }
        }
      
        if (Physics.Raycast (ray, out hit, Mathf.Infinity) && Input.GetMouseButtonDown (0)) {
            if (hit.collider == this.component01.collider) {
                if(compSelected == false){
                    compSelected = true;
                    component01.GetComponent<Renderer> ().material.color = Color.green;
                    speed01 = 0;
                    system.selectionSounds[0].Play(0);
                } else if(compSelected == true){
                    compSelected = false;
                    component01.GetComponent<Renderer> ().material.color = compColorDefault01;
                    speed01 = 66;
                    system.selectionSounds[1].Play(0);
                }
            }
        }

Found the answer. You’d need to add a check for the script component int, to apply it inside the function, like that:

int speed = this.transform.GetComponent<system>().speed01;

correction: it needs to be inside the start block to get the initial speed. Nested inside the update block, it will catch it’s latest speed obviously.