Fix cone make it look nice
This commit is contained in:
parent
4f57499e40
commit
c5c02ecc7e
2 changed files with 11 additions and 4 deletions
|
|
@ -37,6 +37,11 @@ namespace TD.Visuals
|
|||
[Min(0.001f)]
|
||||
[SerializeField] private float height = 1f;
|
||||
|
||||
[Tooltip("Rotation of the base ring around the vertical axis, in degrees. With a low " +
|
||||
"side count this makes a pyramid; e.g. sides = 4 with a 45° offset and " +
|
||||
"radius 0.7071 yields a square-based pyramid whose faces align to the X/Z axes.")]
|
||||
[SerializeField] private float angularOffsetDegrees = 0f;
|
||||
|
||||
private Mesh mesh;
|
||||
|
||||
private void OnEnable() => Rebuild();
|
||||
|
|
@ -89,7 +94,8 @@ namespace TD.Visuals
|
|||
var vertices = new Vector3[sides + 2];
|
||||
for (int i = 0; i < sides; i++)
|
||||
{
|
||||
float angle = (i / (float)sides) * Mathf.PI * 2f;
|
||||
float angle = (i / (float)sides) * Mathf.PI * 2f
|
||||
+ angularOffsetDegrees * Mathf.Deg2Rad;
|
||||
vertices[baseRingStart + i] = new Vector3(
|
||||
Mathf.Cos(angle) * radius,
|
||||
-halfHeight,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue