public override void OnPreRaycast() { if (LineBase == null) { return; } // Make sure our array will hold if (Rays == null || Rays.Length != LineCastResolution) { Rays = new RayStep[LineCastResolution]; } // Set up our rays // Turn off gravity so we get accurate rays GravityDistorter.enabled = false; float stepSize = 1f / Rays.Length; Vector3 lastPoint = LineBase.GetUnClampedPoint(0f); for (int i = 0; i < Rays.Length; i++) { Vector3 currentPoint = LineBase.GetUnClampedPoint(stepSize * (i + 1)); Rays[i].UpdateRayStep(ref lastPoint, ref currentPoint); lastPoint = currentPoint; } // Re-enable gravity if we're looking at a hotspot GravityDistorter.enabled = (TeleportSurfaceResult == TeleportSurfaceResult.HotSpot); }
/// <inheritdoc /> protected override void UpdateRays() { // Make sure our array will hold if (Rays == null || Rays.Length != LineCastResolution) { Rays = new RayStep[LineCastResolution]; } float stepSize = 1f / Rays.Length; Vector3 lastPoint = LineBase.GetUnClampedPoint(0f); for (int i = 0; i < Rays.Length; i++) { Vector3 currentPoint = LineBase.GetUnClampedPoint(stepSize * (i + 1)); Rays[i].UpdateRayStep(ref lastPoint, ref currentPoint); lastPoint = currentPoint; } }