I'm trying to create random astroid looking polys but the code below will not work. It just creates vertices on the bottom right quarter of the poly, and disregards the wanted radius of the poly. My math might be screwed up, but it shouldn't be. Why Doesn't this work? Method BuildPoly:tVector2[] (NumVertices:Int, radius:Float)
Local Vertices:tVector2[NumVertices]
For Local i:Int = 0 to NumVertices - 1
Local a:Float = 2.0 * pi * (i / Float(NumVertices))
Vertices[i] = tVector2.Create(Cos(a), Sin(a))
Vertices[i].Mult(radius)
Next
Return Vertices
End Method Any help would be great!
|