1 год назад
История
README.md
using UnityEngine;
public class PointsCircleGizmo : MonoBehaviour
{
[SerializeField]
private int _countLines = 10;
[SerializeField, Tooltip( "Угол начала дуги( правая точка )" )]
private float _startAngle = -70f;
private readonly float _centerAngle = -90;
[SerializeField]
private float _angle = 0;
[SerializeField]
private float _beamLength = 40;
private Vector3 startPosition;
private void OnDrawGizmos()
{
Gizmos.color = Color.blue;
float arcLength = ( Mathf.Abs( _centerAngle ) - Mathf.Abs( _startAngle ) ) * 2;
//Правка позиции руки. ( + - координаты )
arcLength = _startAngle > 0 ? arcLength * -1 : arcLength * 1;
startPosition = transform.position;
_angle = arcLength / ( _countLines - 1f );
for ( int i = 0; i < _countLines; i++ )
{
Quaternion rotation = Quaternion.Euler( 0f , _startAngle - ( _angle * i ) , 0f );
Vector3 direction = rotation * new Vector3( 0 , 0f , _beamLength );
Vector3 finalPosition = startPosition + direction;
Gizmos.DrawLine( transform.position , finalPosition );
}
}
}
Описание
Распределение лучей ( точек ) по длине дуги с Gizmo
Конвейеры
0 успешных
0 с ошибкой