hi all,
i am plotting an ellipse using the code attached to this question, and it works great! but i need to be able to plot the ellipse based on a different rotation. im plotting the points on the x,z plane, and need to be able to plot it from a different starting y rotation , but i cant figure out how to do it. i dont know whether there is some whay to change or add to the basic ellipse plotting code, to change its whole rotation, or somehow use an empty game object as a reference transform, and plot local to that?
thanks,
paul uk
public void plotellipse(float radiusA, float radiusB){
float perimeter = ellipseperimeter (radiusA, radiusB);
perimeter = Mathf.Round (perimeter);
Debug.Log (perimeter);
float segments = 360f / perimeter;
Debug.Log (segments);
for (int i = 0; i < segments; i++) {
float x = Mathf.Sin (Mathf.Deg2Rad * angle) * radiusA;
float z = Mathf.Cos (Mathf.Deg2Rad * angle) * radiusB;
GameObject newsphere = Instantiate (sphere, new Vector3 (x, 0f, z), Quaternion.identity);
angle += (360f / segments);
}