void Update() { #if !UNITY_EDITOR if (EarlyOut()) { return; } /* #else // Draw debug info * float distance = (arcRaycaster.velocity * arcRaycaster.velocity) * Mathf.Sin ((2.0f * arcRaycaster.Angle) * Mathf.Deg2Rad) / arcRaycaster.acceleration; * Vector3 dir = Vector3.ProjectOnPlane(arcRaycaster.ControllerForward, Vector3.up); * Debug.DrawLine (arcRaycaster.Start, arcRaycaster.Start + dir.normalized * 500, Color.blue); * Vector3 point = arcRaycaster.Start + dir.normalized * distance; * Debug.DrawLine (point + Vector3.up, point - Vector3.up, Color.red); */ #endif arcRenderer.SetPosition(0, arcRaycaster.Start); Vector3 v = raycaster.Velocity; Vector3 a = raycaster.Acceleration; float recip = 1.0f / (float)(segments - 1); for (int i = 1; i < segments; i++) { float t = (float)i * recip; t *= raycaster.FlightTime; if (t > raycaster.HitTime) { t = raycaster.HitTime; } arcRenderer.SetPosition(i, raycaster.SampleCurve(arcRaycaster.Start, v, a, t)); } SetCurveVisuals(); }
void Update() { #if !UNITY_EDITOR if (EarlyOut()) { return; } /* #else // Draw debug info * float distance = (arcRaycaster.velocity * arcRaycaster.velocity) * Mathf.Sin ((2.0f * arcRaycaster.Angle) * Mathf.Deg2Rad) / arcRaycaster.acceleration; * Vector3 dir = Vector3.ProjectOnPlane(arcRaycaster.ControllerForward, Vector3.up); * Debug.DrawLine (arcRaycaster.Start, arcRaycaster.Start + dir.normalized * 500, Color.blue); * Vector3 point = arcRaycaster.Start + dir.normalized * distance; * Debug.DrawLine (point + Vector3.up, point - Vector3.up, Color.red); */ #endif //display when touchpad is touched but only if trigger is not pressed if (transform.parent.GetComponent <PlayerControl>().lastTouchState&& !transform.parent.GetComponent <PlayerControl>().lastTriggerState) { arcRenderer.startWidth = .01f; arcRenderer.endWidth = .01f; arcRenderer.SetPosition(0, raycaster.origin); Vector3 v = raycaster.Velocity; Vector3 a = raycaster.Acceleration; float recip = 1.0f / (float)(segments - 1); for (int i = 1; i < segments; i++) { float t = (float)i * recip; t *= raycaster.FlightTime; if (t > raycaster.HitTime) { t = raycaster.HitTime; } arcRenderer.SetPosition(i, raycaster.SampleCurve(raycaster.origin, v, a, t)); } contactIndicator.localScale = new Vector3(1f, 1f, 1f); } else { //hide arc renderer arcRenderer.startWidth = 0; arcRenderer.endWidth = 0; contactIndicator.localScale = new Vector3(.001f, .001f, .001f); } SetCurveVisuals(); }