- Home /
tank turret rotate without messing up
im trying to make a tank turret rotate, with him i want 2 cameras, and a barrel(a separet object parented to the turret) to rotate, now the problem is when i parrent the objects it will set the center to an average possition of both the turret and the barel and pivot arround these points, anny idea how to fix this?(and yea i tried to use an empty object and it does the same)
i mean while the game is running the barrel is getting out of were it should be. its rotation its the same but the distance from the turret changes constantly
Answer by MCHammond · Dec 16, 2012 at 11:35 PM
In the Unity editor at the top left of the screen you will see the transformation tools "Move, rotate and scale". Right of them you will see the tool handle options, were it says Center change it to Pivot and you will rotate around the pivot point rather than the center.
Answer by cumhuryozcan · Dec 16, 2012 at 11:35 PM
If you are trying to do this via the GUI (like in the scene view), you will see a button called center left to the play button (and just below the Game Object Menu). Click it and you will see it has changed to pivot. Now your tool handle (thing you called center in your question) is placed on the parent object, not somewhere at the middle.
If you try to do this via a script, the pivot is always middle of the object on which the script is attached. Just check if you put attach the script to right one.
Your answer
![](https://koobas.hobune.stream/wayback/20220613085526im_/https://answers.unity.com/themes/thub/images/avi.jpg)