예제 #1
0
 public void SetTargetPosition(Vector3 pos, MovementGazeTarget target, bool immediateUpdate = false)
 {
     if (!moving || immediateUpdate)
     {
         currentTarget  = target;
         targetPosition = pos;            // - new Vector3(0,1.8f,0);
         distance       = (targetPosition - previousPosition).magnitude;
         if (immediateUpdate)
         {
             moving             = false;
             previousPosition   = targetPosition;
             transform.position = targetPosition;
         }
         else
         {
             ///these are poorly named - not really 'time' more like normalized time
             smoothInTime  = Mathf.Clamp(smoothInPercent / distance, 0, 0.5f);
             smoothOutTime = Mathf.Clamp(smoothOutPercent / distance, 0, 0.5f);
             linearTime    = 1f - smoothInTime - smoothOutTime;
             smoothedBlend = blend = 0;
             moving        = true;
         }
     }
 }
예제 #2
0
 public void ClearTarget()
 {
     moving        = false;
     currentTarget = null;
 }
예제 #3
0
 public void SetTarget(MovementGazeTarget target)
 {
     SetTargetPosition(target.transform.position, target, true);
 }
예제 #4
0
 public void SetTargetPosition(Vector3 pos, MovementGazeTarget target, bool immediateUpdate = false)
 {
     if(!moving || immediateUpdate){
         currentTarget = target;
         targetPosition = pos;// - new Vector3(0,1.8f,0);
         distance = (targetPosition - previousPosition).magnitude;
         if(immediateUpdate){
             moving = false;
             previousPosition = targetPosition;
             transform.position = targetPosition;
         }
         else{
             ///these are poorly named - not really 'time' more like normalized time
             smoothInTime = Mathf.Clamp(smoothInPercent/distance,0,0.5f);
             smoothOutTime = Mathf.Clamp(smoothOutPercent/distance,0,0.5f);
             linearTime = 1f - smoothInTime - smoothOutTime;
             smoothedBlend = blend = 0;
             moving = true;
         }
     }
 }
예제 #5
0
 public void SetTarget(MovementGazeTarget target)
 {
     SetTargetPosition(target.transform.position,target, true);
 }
예제 #6
0
 public void ClearTarget()
 {
     moving = false;
     currentTarget = null;
 }