how to rotate game-Object in a fixed position

I am new to unity.I am developing a project on rotating the Game-Object on its fixed position while swiping.Actually i can rotate the object with “transform.rotateAround” as well as “transform.Rotate” but my problem is my game object its moving from its place while rotating which i dont want.I want it to be stable.I cant figure out the problem.Can any help me with this?
I have attached my program below,

#pragma strict

var cube:Transform;

function Start () {
cube = GameObject.Find(“cube”).transform;

function Update () {

if(Input.touchCount >= 1) {
	if (Input.touchCount == 2 && Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved) {
		var touch1:Touch = Input.GetTouch(0);
		var touch2:Touch = Input.GetTouch(1);

		if(touch1.deltaPosition.x > 0 && touch2.deltaPosition.x > 0) {
			Rotate3DObject(touch1, touch2);
		} else if(touch1.deltaPosition.x < 0 && touch2.deltaPosition.x < 0) {
			Rotate3DObject1(touch1, touch2);


function Rotate3DObject(touch1:Touch, touch2:Touch) {



Put your object in another empty gameobject. Move the child object (your object) so its center matches the pivot of the parent object. Add your rotating script to the parent object. That should do it.

If you still see that your object is moving while rotating, try to make it centered with the parent’s pivot again.