- Home /
Question by
eliascanaza · Nov 15, 2013 at 10:37 PM ·
camerasmoothfollow
Camera zoom in and zoom out of the target with smoothfollow
Hi everyone ... i want to make camera zoomin and zoomout of target with smoothfollow script, i have distance and height from camera i try it, but i have problems
void On_PinchIn(Gesture gesture){
distance += gesture.deltaPinch*10;
distance = Mathf.Clamp(distance, 5, 20);
y = ClampAngle(y, 20, 80);
Quaternion rotation = Quaternion.Euler(y, x, 0);
Transform position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.position = Vector3.Lerp(transform.position, position, 5*Time.deltaTime);
transform.rotation = rotation;
}
any idea for that..
Comment