public float journetTime = 10f;
private float startTime;
public Transform sunrise;
public Transform sunset ;
Vector3 center ;
Vector3 riseCenter;
Vector3 setCenter;
float fracTime;
// Use this for initialization
void Start ()
{
startTime = Time.time;
}
// Update is called once per frame
void Update ()
{
// center = sunrise.position + sunset.position * 0.5F;
center = (sunset.position + sunrise.position);
center = new Vector3 (center.x / 2, center.y / 2, center.z / 2);
center -= new Vector3 (0f, 1f, 0f);
riseCenter = sunrise.position - center;
// riseCenter = sunrise.position;
// setCenter = sunset.position;
setCenter = sunset.position - center;
fracTime = (Time.time - startTime) / journetTime;
transform.position = Vector3.Slerp (riseCenter, setCenter, fracTime);
transform.position += center;
}
private float startTime;
public Transform sunrise;
public Transform sunset ;
Vector3 center ;
Vector3 riseCenter;
Vector3 setCenter;
float fracTime;
// Use this for initialization
void Start ()
{
startTime = Time.time;
}
// Update is called once per frame
void Update ()
{
// center = sunrise.position + sunset.position * 0.5F;
center = (sunset.position + sunrise.position);
center = new Vector3 (center.x / 2, center.y / 2, center.z / 2);
center -= new Vector3 (0f, 1f, 0f);
riseCenter = sunrise.position - center;
// riseCenter = sunrise.position;
// setCenter = sunset.position;
setCenter = sunset.position - center;
fracTime = (Time.time - startTime) / journetTime;
transform.position = Vector3.Slerp (riseCenter, setCenter, fracTime);
transform.position += center;
}