void Update() { if (this.actor_ == null) { return; } float angle = GetAngle(this.actor_, this.Target); float maxAngle = Mathf.Max(this.MaxAngleMinimum, this.MaxAngleBase - this.MaxAngleDistanceCorrection * (this.Target.position - this.actor_.position).magnitude); bool isFocused = angle <= maxAngle; if (isFocused && this.gazer_ == null) { this.gazer_ = this.Gazeable.StartGazer(); } if (this.gazer_ != null && !isFocused) { this.gazer_.Dispose(); this.gazer_ = null; } #if UNITY_EDITOR DebugInfo.Angle = angle; DebugInfo.MaxAngle = maxAngle; #endif }
void Update() { var cam = this.GazeCamera == null ? Camera.main : this.GazeCamera; if (cam == null || this.Gazeable == null || this.Collider == null) { return; } Ray gazeRay = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0.0f)); RaycastHit raycastHit; bool hit = this.Collider.Raycast(gazeRay, out raycastHit, this.MaxDistance); // Just started gazing? if (hit && this.gazer_ == null) { this.gazer_ = this.Gazeable.StartGazer(); } // Just ended our gaze? if (this.gazer_ != null && !hit) { this.gazer_.Dispose(); this.gazer_ = null; } }
private void OnDisable() { if (this.gazer_ != null) { this.gazer_.Dispose(); this.gazer_ = null; } }
void Update() { this.focusPercentage_ = GetFocusPercentage(this.actor_, this.target); #if UNITY_EDITOR this.DebugInfo.FocusPercentage = this.focusPercentage_; #endif bool isFocused = focusPercentage_ >= minFocusLevel; if (isFocused && this.gazer_ == null) { this.gazer_ = this.gazeable.StartGazer(); } if (this.gazer_ != null && !isFocused) { this.gazer_.Dispose(); this.gazer_ = null; } }
void Update() { var cam = this.RayCamera == null ? Camera.main : this.RayCamera; if (cam == null || this.Gazeable == null || this.RaycastReceiver == null) { return; } bool hit = RaycastReceiver.Raycast(new Vector2(0.5f, 0.5f), cam); // Just started gazing? if (hit && this.gazer_ == null) { this.gazer_ = this.Gazeable.StartGazer(); } // Just ended our gaze? if (this.gazer_ != null && !hit) { this.gazer_.Dispose(); this.gazer_ = null; } }