Example #1
0
 // Update is called once per frame
 private void Update()
 {
     if (smoothMove)
     {
         lastPosition           = Vector3.Lerp(lastPosition, rail.ProjectPositionOnRail(lookAt.position), moveSpeed * Time.deltaTime);
         thisTransform.position = lastPosition;
     }
     else
     {
         thisTransform.position = rail.ProjectPositionOnRail(lookAt.position);
     }
     thisTransform.LookAt(lookAt.position);
 }
Example #2
0
 private void Update()
 {
     if (smoothMove)
     {
         lastPosition           = Vector3.Lerp(lastPosition, rail.ProjectPositionOnRail(lookAt.position), Time.deltaTime);
         thisTransform.position = lastPosition;
     }
     else
     {
         thisTransform.position = rail.ProjectPositionOnRail(lookAt.position);
     }
     thisTransform.LookAt(lookAt.position);
     // thisTransform.position = rail.ProjectOnSegment(Vector3.zero, Vector3.forward * 20, lookAt.position);
 }
    private void Update()
    {
        //If smooth moved is activated (true) then smoothly lerp the transition stage from the last position of the camera to another point on the rail.
        if (smooth_move)
        {
            last_position             = Vector3.Lerp(last_position, rail.ProjectPositionOnRail(look_at.position), Time.deltaTime * move_speed);
            camera_transform.position = last_position;
        }

        //FOR TESTING PURPOSES!
        //camera_transform.position = rail.ProjectOnSegment(Vector3.zero, Vector3.forward * 20, look_at.position);

        camera_transform.position = rail.ProjectPositionOnRail(look_at.position);

        camera_transform.LookAt(look_at.position);
    }