public void DrawWithExtraSize(Color color, float offset) { for (int i = 0; i < _listLines.Length; i++) { ExtDrawGuizmos.DebugCapsuleFromInsidePoint(_listLines[i].P1, _listLines[i].P2, color, offset, 0, true, false); } }
/// <summary> /// - Debugs a cylinder. /// </summary> /// <param name='start'> /// - The position of one end of the cylinder. /// </param> /// <param name='end'> /// - The position of the other end of the cylinder. /// </param> /// <param name='color'> /// - The color of the cylinder. /// </param> /// <param name='radius'> /// - The radius of the cylinder. /// </param> /// <param name='duration'> /// - How long to draw the cylinder. /// </param> /// <param name='depthTest'> /// - Whether or not the cylinder should be faded when behind other objects. /// </param> public static void DebugCylinder(Vector3 start, Vector3 end, Color color, float radius = 1, float duration = 0, bool depthTest = true) { Vector3 up = (end - start).normalized * radius; Vector3 forward = Vector3.Slerp(up, -up, 0.5f); Vector3 right = Vector3.Cross(up, forward).normalized *radius; //Radial circles ExtDrawGuizmos.DebugCircle(start, up, color, radius, duration, depthTest); ExtDrawGuizmos.DebugCircle(end, -up, color, radius, duration, depthTest); ExtDrawGuizmos.DebugCircle((start + end) * 0.5f, up, color, radius, duration, depthTest); //Side lines Debug.DrawLine(start + right, end + right, color, duration, depthTest); Debug.DrawLine(start - right, end - right, color, duration, depthTest); Debug.DrawLine(start + forward, end + forward, color, duration, depthTest); Debug.DrawLine(start - forward, end - forward, color, duration, depthTest); //Start endcap Debug.DrawLine(start - right, start + right, color, duration, depthTest); Debug.DrawLine(start - forward, start + forward, color, duration, depthTest); //End endcap Debug.DrawLine(end - right, end + right, color, duration, depthTest); Debug.DrawLine(end - forward, end + forward, color, duration, depthTest); }
public void ShowCircumsphere(Color color, float duration) { Vector3 circumCenter = new Vector3(_d.x / (2 * _a), _d.y / (2 * _a), _d.z / (2 * _a)); float circumRadius = Mathf.Sqrt(_d.sqrMagnitude - 4 * _a * _c) / (2 * Mathf.Abs(_a)); ExtDrawGuizmos.DebugWireSphere(circumCenter, color, circumRadius, duration, false); }
/// <summary> /// calculate trajectory of entity ///rigidbody: rb of the object ///pos: position from where to start the plot Trajectory ///velocity: current velocity of the rigidbody ///steps: numbers of steps ///applyForceUp: do we apply additionnal gravity when going upward ? ///applyForceDown: do we apply additionnal gravity when going down ? /// </summary> public Vector3[] Plots(Rigidbody rigidbody, Vector3 pos, Vector3 velocity, int steps, bool applyForceUp, bool applyForceDown) { Vector3[] results = new Vector3[steps]; float timestep = Time.fixedDeltaTime / magicTrajectoryCorrection; //magicCorection = 1 float drag = 1f - timestep * rigidbody.drag; //take into account the rb drag Vector3 moveStep = velocity * timestep; int i = -1; while (++i < steps) { //get the gravity direction, depending on the position Vector3 gravityOrientation = entityGravity.CalculateGravity(pos); //Get the vector acceleration (dir + magnitude) Vector3 gravityAccel = entityGravity.FindAirGravity(pos, moveStep, gravityOrientation, applyForceUp, applyForceDown) * timestep;// * timestep; moveStep += gravityAccel; moveStep *= drag; pos += moveStep;// * timestep; results[i] = pos; ExtDrawGuizmos.DebugWireSphere(pos, Color.white, 0.1f, 5f); } return(results); }
//Wiresphere already exists /// <summary> /// - Draws a cylinder. /// </summary> /// <param name='start'> /// - The position of one end of the cylinder. /// </param> /// <param name='end'> /// - The position of the other end of the cylinder. /// </param> /// <param name='color'> /// - The color of the cylinder. /// </param> /// <param name='radius'> /// - The radius of the cylinder. /// </param> public static void DrawCylinder(Vector3 start, Vector3 end, Color color, float radius = 1.0f) { Vector3 up = (end - start).normalized * radius; Vector3 forward = Vector3.Slerp(up, -up, 0.5f); Vector3 right = Vector3.Cross(up, forward).normalized *radius; //Radial circles ExtDrawGuizmos.DrawCircle(start, up, color, radius); ExtDrawGuizmos.DrawCircle(end, -up, color, radius); ExtDrawGuizmos.DrawCircle((start + end) * 0.5f, up, color, radius); Color oldColor = Gizmos.color; Gizmos.color = color; //Side lines Gizmos.DrawLine(start + right, end + right); Gizmos.DrawLine(start - right, end - right); Gizmos.DrawLine(start + forward, end + forward); Gizmos.DrawLine(start - forward, end - forward); //Start endcap Gizmos.DrawLine(start - right, start + right); Gizmos.DrawLine(start - forward, start + forward); //End endcap Gizmos.DrawLine(end - right, end + right); Gizmos.DrawLine(end - forward, end + forward); Gizmos.color = oldColor; }
protected override void DrawInSceneViewSelected(int index) { if (!_quaternionTarget.DisplayQuaternion) { return; } SerializedProperty waypoint = _waypointList.serializedProperty.GetArrayElementAtIndex(index); SerializedProperty point = waypoint.GetPropertie(nameof(QuaternionPoints.QuaternionWaypoint.Rotation)); Quaternion currentRotationAtSpline = _quaternionTarget.SplineBase.EvaluateOrientation(_quaternionTarget.GetWayPoint(index).PathPosition); Quaternion localRotation = _quaternionTarget.GetRotation(index); Quaternion finalRotation = localRotation * currentRotationAtSpline; Vector3 position = _quaternionTarget.GetPositionFromPoint(index); ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.forward, Color.blue); ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.right, Color.red); ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.up, Color.green); Matrix4x4 matrix = Matrix4x4.TRS(position, currentRotationAtSpline, Vector3.one * 0.6f); using (new Handles.DrawingScope(matrix)) { EditorGUI.BeginChangeCheck(); Quaternion rotationHandle = Handles.RotationHandle(localRotation, Vector3.zero); if (EditorGUI.EndChangeCheck()) { point.quaternionValue = rotationHandle; this.ApplyModification(); } } }
public void Trigger(ActionPoints.ActionPointsWaypoint action, object parameters) { //Debug.Log("trigge point " + action.Index + " of " + action.PointLister.Description + " at: " + action.PathPosition, action.ReferenceAction); OnTriggerPoint?.Invoke(action, parameters); #if UNITY_EDITOR //ExtDrawGuizmos.DebugWireSphere(transform.position, action.PointLister.ColorWayPoint, 0.5f, 0.5f); ExtDrawGuizmos.DebugWireSphere(action.PointLister.SplineBase.EvaluatePositionAtUnit(action.PathPosition, action.PointLister.PositionUnits), action.PointLister.ColorWayPoint, 1, 0.5f); #endif }
/// <summary> /// Draws a <seealso cref="Rigidbody" />'s trajectory using <seealso cref="Debug" />.DrawLine. /// </summary> /// <param name="rb"> The body whose trajectory is being drawn. </param> /// <param name="force"> For predicting the effects of a Rigidbody.AddForce() method. Use Vector3.zero if not needed. </param> /// <param name="mode"> Determines how the force vector changes the velocity. Irrelevant when using Vector3.zero. </param> /// <param name="color"> The color of the line being drawn. </param> /// <param name="trajectoryDuration"> Amount of time in seconds to predict. </param> /// <param name="lineDuration"> Amount of time in seconds the drawn line will persist. </param> /// <param name="constantForce"> Will the force be applied every FixedUpdate. </param> /// <param name='depthTest'> Whether or not the line should be faded when behind other objects. </param> public static void DebugTrajectory(this Rigidbody rb, Vector3 force, ForceMode mode, Color color, float trajectoryDuration = 1.0f, float lineDuration = 0.0f, bool constantForce = false, bool depthTest = false) { var positions = rb.GetTrajectory(force, mode, trajectoryDuration, constantForce); ExtDrawGuizmos.DebugWireSphere(positions[0], color, 0.1f, 5f); for (var i = 0; i < positions.Length - 1; i++) { ExtDrawGuizmos.DebugWireSphere(positions[i + 1], color, 0.1f, 5f); //Debug.DrawLine(positions[i], positions[i + 1], color, lineDuration, depthTest); } }
public override void Draw() { Disc.Draw(base.GetColor()); if (!_drawRadius) { return; } if (_radiusMax > 0) { ExtDrawGuizmos.DebugWireSphere(Disc.Position, Color.red, _radiusMax * transform.lossyScale.Maximum()); } }
private void Update() { if (_superTetra != null) { bool isInsideOfCircumsphere = _superTetra.IsPointInCircumcircle(_sphereMesh.transform.position); if (isInsideOfCircumsphere != _isPreviouslyInsideOfCircumsphere) { _sphereMesh.material = isInsideOfCircumsphere ? _greenMaterial : _redMaterial; ExtDrawGuizmos.DebugWireSphere(_sphereMesh.transform.position, Color.cyan, 0.01f, 1000, false); } _isPreviouslyInsideOfCircumsphere = isInsideOfCircumsphere; } }
public void DrawWithExtraSize(Color color, Vector3 extraSize, bool drawFace = false, bool drawPoints = false) { #if UNITY_EDITOR Matrix4x4 cubeMatrix = ExtMatrix.GetMatrixTRS(_position, _rotation, _localScale + extraSize); Vector3 size = Vector3.one; Vector3 p1 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + ((-size) * 0.5f)); Vector3 p2 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(-size.x, -size.y, size.z) * 0.5f)); Vector3 p3 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(size.x, -size.y, size.z) * 0.5f)); Vector3 p4 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(size.x, -size.y, -size.z) * 0.5f)); ExtDrawGuizmos.DrawLocalQuad(p1, p2, p3, p4, color, drawFace, drawPoints); #endif }
public void DrawWithExtraSize(Color color, Vector3 extraSize) { if (extraSize.Maximum() <= 0f) { return; } Matrix4x4 cylinderMatrix = Matrix4x4.TRS(_position, _rotation, (_localScale + extraSize) * _radius); Vector3 size = new Vector3(0, _lenght / 2, 0); Vector3 p1 = cylinderMatrix.MultiplyPoint3x4(Vector3.zero + ((-size))); Vector3 p2 = cylinderMatrix.MultiplyPoint3x4(Vector3.zero - ((-size))); float realRadius = _radius * MaxXY(_localScale + extraSize); ExtDrawGuizmos.DrawCylinder(p1, p2, color, realRadius); }
/// <summary> /// - Draws a capsule. /// </summary> /// <param name='start'> /// - The position of one end of the capsule. /// </param> /// <param name='end'> /// - The position of the other end of the capsule. /// </param> /// <param name='color'> /// - The color of the capsule. /// </param> /// <param name='radius'> /// - The radius of the capsule. /// </param> public static void DrawCapsule(Vector3 start, Vector3 end, Color color, float radius = 1) { Vector3 up = (end - start).normalized * radius; Vector3 forward = Vector3.Slerp(up, -up, 0.5f); Vector3 right = Vector3.Cross(up, forward).normalized *radius; Color oldColor = Gizmos.color; Gizmos.color = color; float height = (start - end).magnitude; float sideLength = Mathf.Max(0, (height * 0.5f) - radius); Vector3 middle = (end + start) * 0.5f; start = middle + ((start - middle).normalized * sideLength); end = middle + ((end - middle).normalized * sideLength); //Radial circles ExtDrawGuizmos.DrawCircle(start, up, color, radius); ExtDrawGuizmos.DrawCircle(end, -up, color, radius); //Side lines Gizmos.DrawLine(start + right, end + right); Gizmos.DrawLine(start - right, end - right); Gizmos.DrawLine(start + forward, end + forward); Gizmos.DrawLine(start - forward, end - forward); for (int i = 1; i < 26; i++) { //Start endcap Gizmos.DrawLine(Vector3.Slerp(right, -up, i / 25.0f) + start, Vector3.Slerp(right, -up, (i - 1) / 25.0f) + start); Gizmos.DrawLine(Vector3.Slerp(-right, -up, i / 25.0f) + start, Vector3.Slerp(-right, -up, (i - 1) / 25.0f) + start); Gizmos.DrawLine(Vector3.Slerp(forward, -up, i / 25.0f) + start, Vector3.Slerp(forward, -up, (i - 1) / 25.0f) + start); Gizmos.DrawLine(Vector3.Slerp(-forward, -up, i / 25.0f) + start, Vector3.Slerp(-forward, -up, (i - 1) / 25.0f) + start); //End endcap Gizmos.DrawLine(Vector3.Slerp(right, up, i / 25.0f) + end, Vector3.Slerp(right, up, (i - 1) / 25.0f) + end); Gizmos.DrawLine(Vector3.Slerp(-right, up, i / 25.0f) + end, Vector3.Slerp(-right, up, (i - 1) / 25.0f) + end); Gizmos.DrawLine(Vector3.Slerp(forward, up, i / 25.0f) + end, Vector3.Slerp(forward, up, (i - 1) / 25.0f) + end); Gizmos.DrawLine(Vector3.Slerp(-forward, up, i / 25.0f) + end, Vector3.Slerp(-forward, up, (i - 1) / 25.0f) + end); } Gizmos.color = oldColor; }
public void Draw(Color color) { _circle.DrawWithExtraSize(color, _realThickNess, false, ""); _circle.DrawWithExtraSize(color, -_realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point + _donutMatrix.RightNormalized() * _realRadius, _donutMatrix.ForwardFast(), color, _realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point + _donutMatrix.LeftNormalized() * _realRadius, _donutMatrix.ForwardFast(), color, _realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point + _donutMatrix.ForwardNormalized() * _realRadius, _donutMatrix.RightFast(), color, _realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point + _donutMatrix.BackwardNormalized() * _realRadius, _donutMatrix.RightFast(), color, _realThickNess, false, ""); Vector3 right = (_donutMatrix.RightNormalized() + _donutMatrix.ForwardNormalized()).FastNormalized(); Vector3 forward = (_donutMatrix.ForwardNormalized() + _donutMatrix.LeftNormalized()).FastNormalized(); ExtDrawGuizmos.DrawCircle(_circle.Point + right * _realRadius, forward, color, _realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point - right * _realRadius, forward, color, _realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point + forward * _realRadius, right, color, _realThickNess, false, ""); ExtDrawGuizmos.DrawCircle(_circle.Point - forward * _realRadius, right, color, _realThickNess, false, ""); }
public void DrawWithExtraSize(Color color, Vector3 extraSize) { #if UNITY_EDITOR Matrix4x4 cubeMatrix = ExtMatrix.GetMatrixTRS(_position, _rotation, _localScale + extraSize); Vector3 size = Vector3.one; Vector3 p1 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + ((-size) * 0.5f)); Vector3 p2 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(-size.x, -size.y, size.z) * 0.5f)); Vector3 p3 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(size.x, -size.y, size.z) * 0.5f)); Vector3 p4 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(size.x, -size.y, -size.z) * 0.5f)); Vector3 p5 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(-size.x, size.y, -size.z) * 0.5f)); Vector3 p6 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(-size.x, size.y, size.z) * 0.5f)); Vector3 p7 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + ((size) * 0.5f)); Vector3 p8 = cubeMatrix.MultiplyPoint3x4(Vector3.zero + (new Vector3(size.x, size.y, -size.z) * 0.5f)); ExtDrawGuizmos.DrawLocalCube(p1, p2, p3, p4, p5, p6, p7, p8, color); #endif }
private static void ShowLinks(TriggerZone points) { if (!points.ShowLinksToActions) { return; } for (int i = 0; i < points.ActionCount; i++) { GameObject reference = points.GetActionByIndex(i); if (reference != null) { float sizeArrow = 0.2f; if (Vector3.SqrMagnitude(points.transform.position - reference.transform.position) > sizeArrow * sizeArrow) { ExtDrawGuizmos.DebugArrowConstant(points.transform.position, -(points.transform.position - reference.transform.position) * 0.8f, new Color(1, 1, 1, 0.1f), sizeArrow); } } } }
static void DrawGizmos(ControllerStickOffset offsetSticker, GizmoType selectionType) { if (Application.isPlaying || offsetSticker == null || offsetSticker.TargetStick == null || offsetSticker.TargetStick.SplineBase == null) { return; } //ControllerStickOffsetEditor stickEditor = (ControllerStickOffsetEditor)CreateEditor((ControllerStickOffset)offsetSticker) as ControllerStickOffsetEditor; //SerializedProperty offset = stickEditor.GetPropertie("_offsetFromTarget"); //SerializedProperty splineProperty = stickEditor.GetPropertie("_spline"); //SplineBase spline = splineProperty.GetValue<SplineBase>(); //stickEditor.UpdatePositionFromEditor(offset, spline); //Gizmos.DrawLine(offsetSticker.transform.position, offsetSticker.TargetStick.transform.position); //DestroyImmediate(stickEditor); offsetSticker.AttemptToStick(); ExtDrawGuizmos.DrawBezier(offsetSticker.transform.position, offsetSticker.TargetStick.transform.position, -offsetSticker.transform.forward, Color.green, 0.5f); Gizmos.DrawLine(offsetSticker.transform.position, offsetSticker.PositionWithoutOffsetFromSpline(offsetSticker.PathPosition)); }
private void OnDrawGizmos() { if (!Application.isPlaying) { return; } if (!AttractorSettings.Instance.ShowArrow) { return; } for (int i = 0; i < _extGravitonCalculation.AttractorCounts; i++) { ExtDrawGuizmos.DebugWireSphere(_extGravitonCalculation.AttractorIndex(i).ContactPoint, Color.green, 0.1f); ExtDrawGuizmos.DrawArrow(_rigidBody.position, _extGravitonCalculation.AttractorIndex(i).NormalizedDirection *_extGravitonCalculation.ForceAmountIndex(i) * AttractorSettings.Instance.RatioSizeArrow, Color.white); } ExtDrawGuizmos.DrawArrow(_rigidBody.position, _gravityDirection * AttractorSettings.Instance.RatioSizeArrow, Color.cyan); }
public bool IsTargetInSight() { RaycastHit hitInfo; Vector3 dir = target.position - headSight.position; int layerMask = Physics.AllLayers; layerMask = ~LayerMask.GetMask("Enemy"); if (Physics.SphereCast(headSight.position, radius, dir, out hitInfo, dir.magnitude + offsetPlayerDist, layerMask, QueryTriggerInteraction.Ignore)) { Debug.Log(hitInfo.collider.gameObject.name); ExtDrawGuizmos.DebugWireSphere(hitInfo.point, Color.blue, radius, 0.1f); Debug.DrawLine(headSight.position, hitInfo.point, Color.blue, 0.1f); return(true); } return(false); }
protected override void DrawInSceneViewSelected(int index) { Vector3 posInSpline = _componentTarget.GetPositionFromPoint(index); Component componentReference = _componentTarget.GetReference(index); if (componentReference == null) { return; } Transform reference = componentReference.transform; Vector3 posOfReference = reference.position; if (!this.GetPropertie("_showTarget").boolValue) { return; } float size = HandleUtility.GetHandleSize(posOfReference) * 0.05f; if (Handles.Button(posOfReference, Quaternion.identity, size, size, Handles.SphereHandleCap)) { Selection.activeObject = reference.gameObject; } ExtDrawGuizmos.DrawBezier(posInSpline, posOfReference, _componentTarget.GetRotationFromPoint(index) * Vector3.right, _componentTarget.ColorWayPoint, 0.5f); if (this.GetPropertie("_showDistance").boolValue) { float distance = Vector3.Distance(posInSpline, reference.position); Vector3 positionDistanceLabel = (posInSpline + reference.position) * 0.5f; PointsOnSplineExtensionEditor.DisplayStringInSceneViewFrom3dPosition(positionDistanceLabel, distance.ToString(".0"), _componentTarget.ColorWayPoint, 8); } if (!Event.current.shift && index == _waypointList.index && index != -1 && this.GetPropertie("_showHandleTarget").boolValue) { ExtHandle.DoHandleMove(reference, true, out bool hasChanged, _target.SplineBase.GridSize); } }
protected static void DrawUnselected(ComponentPoints point, int index) { Vector3 posInSpline = point.GetPositionFromPoint(index); Component reference = point.GetReference(index); if (reference == null) { return; } Vector3 posOfReference = reference.transform.position; ExtDrawGuizmos.DrawBezier(posInSpline, posOfReference, point.GetRotationFromPoint(index) * Vector3.right, point.ColorWayPoint, 0.5f); float size = HandleUtility.GetHandleSize(posOfReference) * 0.05f; Color colorOld = Gizmos.color; Gizmos.color = point.ColorWayPoint; Gizmos.DrawSphere(posOfReference, size); Gizmos.color = colorOld; }
/// <summary> /// - Debugs a capsule. /// </summary> /// <param name='start'> /// - The position of one end of the capsule. /// </param> /// <param name='end'> /// - The position of the other end of the capsule. /// </param> /// <param name='color'> /// - The color of the capsule. /// </param> /// <param name='radius'> /// - The radius of the capsule. /// </param> /// <param name='duration'> /// - How long to draw the capsule. /// </param> /// <param name='depthTest'> /// - Whether or not the capsule should be faded when behind other objects. /// </param> public static void DebugCapsule(Vector3 start, Vector3 end, Color color, float radius = 1, float duration = 0, bool depthTest = true) { Vector3 up = (end - start).normalized * radius; Vector3 forward = Vector3.Slerp(up, -up, 0.5f); Vector3 right = Vector3.Cross(up, forward).normalized *radius; float height = (start - end).magnitude; float sideLength = Mathf.Max(0, (height * 0.5f) - radius); Vector3 middle = (end + start) * 0.5f; start = middle + ((start - middle).normalized * sideLength); end = middle + ((end - middle).normalized * sideLength); //Radial circles ExtDrawGuizmos.DebugCircle(start, up, color, radius, duration, depthTest); ExtDrawGuizmos.DebugCircle(end, -up, color, radius, duration, depthTest); //Side lines Debug.DrawLine(start + right, end + right, color, duration, depthTest); Debug.DrawLine(start - right, end - right, color, duration, depthTest); Debug.DrawLine(start + forward, end + forward, color, duration, depthTest); Debug.DrawLine(start - forward, end - forward, color, duration, depthTest); for (int i = 1; i < 26; i++) { //Start endcap Debug.DrawLine(Vector3.Slerp(right, -up, i / 25.0f) + start, Vector3.Slerp(right, -up, (i - 1) / 25.0f) + start, color, duration, depthTest); Debug.DrawLine(Vector3.Slerp(-right, -up, i / 25.0f) + start, Vector3.Slerp(-right, -up, (i - 1) / 25.0f) + start, color, duration, depthTest); Debug.DrawLine(Vector3.Slerp(forward, -up, i / 25.0f) + start, Vector3.Slerp(forward, -up, (i - 1) / 25.0f) + start, color, duration, depthTest); Debug.DrawLine(Vector3.Slerp(-forward, -up, i / 25.0f) + start, Vector3.Slerp(-forward, -up, (i - 1) / 25.0f) + start, color, duration, depthTest); //End endcap Debug.DrawLine(Vector3.Slerp(right, up, i / 25.0f) + end, Vector3.Slerp(right, up, (i - 1) / 25.0f) + end, color, duration, depthTest); Debug.DrawLine(Vector3.Slerp(-right, up, i / 25.0f) + end, Vector3.Slerp(-right, up, (i - 1) / 25.0f) + end, color, duration, depthTest); Debug.DrawLine(Vector3.Slerp(forward, up, i / 25.0f) + end, Vector3.Slerp(forward, up, (i - 1) / 25.0f) + end, color, duration, depthTest); Debug.DrawLine(Vector3.Slerp(-forward, up, i / 25.0f) + end, Vector3.Slerp(-forward, up, (i - 1) / 25.0f) + end, color, duration, depthTest); } }
public override void DrawRadius(float radius, Color color) { if (Waypoints.Length == 0) { return; } else if (Waypoints.Length == 1) { Vector3 positionWayPoint = EvaluatePositionAtUnit(0, PositionUnits.PathUnits); ExtDrawGuizmos.DebugWireSphere(positionWayPoint, color, radius); } else if (Waypoints.Length == 2) { Vector3 positionWayPoint1 = EvaluatePositionAtUnit(0, PositionUnits.PathUnits); Vector3 positionWayPoint2 = EvaluatePositionAtUnit(1, PositionUnits.PathUnits); ExtDrawGuizmos.DebugCapsuleFromInsidePoint(positionWayPoint1, positionWayPoint2, color, radius); } else { for (int i = 0; i < Waypoints.Length - 1; i++) { Vector3 positionWayPoint1 = EvaluatePositionAtUnit(i, PositionUnits.PathUnits); Vector3 positionWayPoint2 = EvaluatePositionAtUnit(i + 1, PositionUnits.PathUnits); Quaternion rotation1 = EvaluateOrientationAtUnit(i, PositionUnits.PathUnits); Quaternion rotation2 = EvaluateOrientationAtUnit(i + 1, PositionUnits.PathUnits); ExtDrawGuizmos.DebugCircle(positionWayPoint1, rotation1 * Vector3.forward, color, radius); ExtDrawGuizmos.DebugCircle(positionWayPoint2, rotation2 * Vector3.forward, color, radius); if (i == 0) { ExtDrawGuizmos.DrawHalfWireSphere(positionWayPoint1, rotation1 * -Vector3.forward, color, radius); } else if (i + 2 >= Waypoints.Length) { ExtDrawGuizmos.DrawHalfWireSphere(positionWayPoint2, rotation2 * Vector3.forward, color, radius); } } } }
//[DrawGizmo(GizmoType.Active | GizmoType.NotInSelectionHierarchy // | GizmoType.InSelectionHierarchy | GizmoType.Pickable, typeof(QuaternionPoints))] //static void DrawGizmos(QuaternionPoints points, GizmoType selectionType) //{ // if (points.gameObject == Selection.activeGameObject) // { // return; // } // if (!points.ShowWayPointsWhenUnselected) // { // return; // } // for (int i = 0; i < points.WaypointsCount; ++i) // { // DrawUnselected(points, i); // } //} protected static void DrawUnselected(QuaternionPoints point, int index) { if (!point.DisplayQuaternion) { return; } Quaternion currentRotationAtSpline = point.SplineBase.EvaluateOrientation(point.GetWayPoint(index).PathPosition); Quaternion localRotation = point.GetRotation(index); Quaternion finalRotation = localRotation * currentRotationAtSpline; Vector3 position = point.GetPositionFromPoint(index); ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.forward, Color.blue); ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.right, Color.red); ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.up, Color.green); //Vector3 posInSpline = position + Vector3.down * 0.3f; //Vector3 rotationData = localRotation.eulerAngles; ////Vector3 position = posInSpline + localPosition; //string positionDisplay = (int)rotationData.x + " : " + (int)rotationData.y + " : " + (int)rotationData.z; //PointsOnSplineExtensionEditor.DisplayStringInSceneViewFrom3dPosition(posInSpline, positionDisplay, point.ColorWayPoint, 10); }
public void DrawWithExtraRadius(Color color, float radius) { ExtDrawGuizmos.DrawHalfWireSphere(Position, Rotation * Vector3.up, color, _realRadius + radius); }
public void Draw(Color color) { ExtDrawGuizmos.DrawHalfWireSphere(Position, Rotation * Vector3.up, color, _realRadius); }
public void Draw(Color color, bool drawFace = false, bool drawPoints = false) { #if UNITY_EDITOR ExtDrawGuizmos.DrawLocalQuad(this, color, drawFace, drawPoints, true); #endif }
public void Draw(Color color, bool drawFace, bool drawPoints) { #if UNITY_EDITOR ExtDrawGuizmos.DrawLocalCube(_p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, color, drawFace, drawPoints); #endif }
private void OnDrawGizmos() { ExtDrawGuizmos.DebugWireSphere(rb.position, Color.red, distForChase); ExtDrawGuizmos.DebugWireSphere(rb.position, Color.green, distForLosePlayer); }
public void Draw(Color color) { ExtDrawGuizmos.DebugCapsuleFromInsidePoint(_p1, _p2, color, _realRadius); }