# Rotation problem with finger

Hello. No matter how many times that i swipe the model camera keep returning back to one position. Am i done something wrong with this script please help me.THank you

using UnityEngine;
using System.Collections;

public class rotate : MonoBehaviour {

public Transform lookAt;
public Transform camTransform;

private Camera cam;

private float distance = 10.0f;
private float currentX = 0.0f;
private float currentY = 0.0f;
private float sensivityX = 4.0f;
private float sensivityY = 1.0f;

private void Start()
{
camTransform = transform;
cam = Camera.main;
}
private void Update()
{
currentX += Input.GetAxis (“Mouse X”);
currentY += Input.GetAxis (“Mouse Y”);
}

private void LateUpdate()
{
Vector3 dir = new Vector3 (0, 0, -distance);
Quaternion rotation = Quaternion.Euler (currentY, currentX,0);
camTransform.position = lookAt.position + rotation * dir;
camTransform.LookAt (lookAt.position);
}
}

2843856–207621–rotate.cs (809 Bytes)

Lets look at these these two lines here:

``````Vector3 dir = new Vector3 (0, 0, -distance);
Quaternion rotation = Quaternion.Euler (currentY, currentX,0);
``````

You then multiplying dir * rotation. so the 0currentY , 0currentX, -distance*0 = 0,0,0

When you add 0,0,0 to lookAt.position you will always get lookAt position

First of all, that is not a Vector3 * Vector3 multiplication, but Quaternion * Vector3.
Second, Vector3 * Vector3 is not defined in Unity, and definitely not like this.

Quaternion * Vector3 (in Unity) means rotating the Vector by the rotation defined by the quaternion, and is perfectly valid (in ‘real’ maths it would be quaternion * vector * ~quaternion, where ~ denotes the conjugate, but that is how the * operator for Quaternion * Vector3 is defined in Unity).

To the original poster: The problem must lie elsewhere. This script works absolutely fine.

Well guys thanks for the help i think i should search help from someone else