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; } } }
public void ClearTarget() { moving = false; currentTarget = null; }
public void SetTarget(MovementGazeTarget target) { SetTargetPosition(target.transform.position, target, true); }
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; } } }
public void SetTarget(MovementGazeTarget target) { SetTargetPosition(target.transform.position,target, true); }