- Home /
 
               Question by 
               oOZerOo · Nov 28, 2012 at 04:51 PM · 
                smooth follow  
              
 
              About Smooth Follow
I Try change Smooth Follow script to c# and change some for my project.likt that using UnityEngine; using System.Collections;
 public class SmoothFollowCShanp : MonoBehaviour {
 
 
 
 public float distance = 10.0f;
 public float height = 5.0f;
 public float heightDamping = 2.0f;
 public float rotationDamping = 3.0f;
     
 public int i=0;
 public Transform[] target;
     
     [AddComponentMenu("Camera-Control/Smooth Follow CShanp")]
     void LateUpdate () 
     {
         if (target.Length<1)
             return;    
         
         setLocalCamera();
     }
     
     
     void Start()
     {
         InvokeRepeating("ChangeCamera",5,5);    
     }
     
     void ChangeCamera()
     {
 
         if (i >= 10)
             i = 0;
         i++;
     }
     
     private Vector3 CamerPos;
 
     
     void setLocalCamera()
     {
         float wantedRotationAngle = target[i].eulerAngles.y;
         float wantedHeight = target[i].position.y + height;            
         float currentRotationAngle = transform.eulerAngles.y;        
         float currentHeight = transform.position.y;    
         
         currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);    
         currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);    
         Quaternion currentRotation = Quaternion.Euler (0, currentRotationAngle, 0);
 
 
 
         transform.position = target[i].position;    
         **transform.position -=  currentRotation * Vector3.left * distance;**    
         transform.position = new Vector3(transform.position.x,currentHeight,transform.position.z);
 
         transform.LookAt (target[i]);    
     }
 }
I Just change theVector3.forward to Vector3.left.But it can't work,It Rotation every time?What the problems whit this?
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Spherical Movement follow Camera jittery movement. 0 Answers
how can i make the main cam smooth follow a new prefab that i add after the game start . 5 Answers
The problem with the touch-control orbit view in the scene 0 Answers
Switch Smooth Follow between targets smoothly 1 Answer
Camera follow jitter 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                