I have created an object orbitting in 3D space usinf iTween’s as shown below
void Start () {
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("Orbit01"), "easetype", "linear", "time",15, "islocal",true, "orientToPath",true, "lookTime", 0.2, "loopType", "loop"));
}
I want to move my follower camera along with the orbitting object in such a way that the camera is linked to the object with some sort of elastic connection; (i.e. distance between camera position and object position is not constant). I wrote the following code. It works kind of okay but the orbitting object appears jittery/choppy from the follower camera. I’ve tested few different methods and could not get rid of the jitter.
using UnityEngine;
using System.Collections;
public class FollowerCamera : MonoBehaviour {
public Transform target;
public Vector3 positionOffset = new Vector3(2,2,2);
public float lookUpdateTime = 1.0f;
public float moveUpdateTime = 3.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// METHOD-1 (From this follower camera, targets motion appears a choppy. )
//iTween.LookUpdate(gameObject, iTween.Hash("looktarget",target.position , "time", lookUpdateTime));
//iTween.MoveUpdate(gameObject, iTween.Hash("position",target.position+positionOffset, "time",moveUpdateTime));
// METHOD-2 (From this follower camera, targets motion appears a choppy. )
iTween.MoveUpdate(gameObject, iTween.Hash("position",target.position+positionOffset, "looktarget",target.position, "looktime",lookUpdateTime, "time",moveUpdateTime));
// YOUR METHOD
//iTween.???
}
}
Can anybody suggests a solution?
I Lv iTween!
-Kaya