Rotating object around one particular point

Hello,

I am sepnding evening trying to figure out how to rotate an object arround another point. Particulary, I want to rotate the first cylinder around the center of all three cylinders. I know of RotateArround function but can’t figure it out.

I firstly tried to rotate it arround the third (right-most) cylinder this way, but nothing happens:

var rotateSpeed = 20.0;
var rotation_center_object: Transform = GameObject.FindWithTag("Podstavek_active").transform;
function Update () {
    transform.RotateAround(transform.position, rotation_center_object.up, Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime);
}

Here is the general situation what I want to do:

create A empty game object assign your script to that object and then that will be your root object…now assign the object that you would like rotating around the cylinder offset it move it slightly to the left or right and with a bit of luck that should do the trick

As far as I understand transform.RotateAround, you need to pass the position you want to rotate around as the first variable, and the axis on which you want to rotate as the second.

Comparing your code and my explanation, you should change the first parameter to rotation_center_object.position.

var rotateSpeed = 20.0;
var rotation_center_object: Transform = GameObject.FindWithTag("Podstavek_active").transform;
function Update () {
    transform.RotateAround([B]rotation_center_object.position[/B], rotation_center_object.up, Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime);
}

Just in case the other answers don’t work.

What I would - not the nicest but should work

Create an Empty and move it at center // put the cylinder as child // rotate the empty and the cylinder should follow

based off his question would it be simpliar on the engine to rotate the empty with the other items ancored to it? just a thought to keep the coding shorter and simpliar.