i have written a camera script in Unity3D to rotate on swipe in left, right, up or down direction and then slow down gradually.
and my camera is looking at the car..while rotating rotating around it.
the only thing i was doing is to clamp the value of the camera rotation when the user swiped up or down..because i don't want the camera to go above the car or under the car while rotating.
i tried this code for clamping..but in vain
Vector3objRot = cachedTransform.rotation.eulerAngles;
float clampValue = Mathf.Clamp(objRot.x, 20, 50);
cachedTransform.rotation.eulerAngles.Set(clampValue, objRot.y, objRot.z);
am attaching my camera script..if you guys could help me out to figure it out.
Any suggestion Please.
[attachment=22207:CameraScript.txt]