I am using c# but I am hoping the mathematics SO is a better place for this question.
I have a point (x, y, z) and I am looking to create x (pointCount) number of points around it like a hula hoop.
What I have so far circles around vertically above and below the point and not around it.
float centerX = transform.position.x;
float centerY = transform.position.y;
float centerZ = transform.position.z;
// Get the rotation of the character in degrees
float rotation = transform.rotation.eulerAngles.y;
// Loop through each angle and calculate the x and y coordinates of the point at that angle
for (float angle = 0; angle < 360; angle += 360.0f / pointCount)
{
//angle will equal e.g. 30, 60, 90, 120 .... etc
float x = centerX + distance * Mathf.Sin((angle + rotation) * Mathf.Deg2Rad);
float y = centerY + distance * Mathf.Cos((angle + rotation) * Mathf.Deg2Rad);
float z = centerZ + 1.0f * Mathf.Clamp(Mathf.Sin(angle * Mathf.Deg2Rad), -1.0f, 1.0f);
// Create a Vector3 object for the point and add it to the list
Vector3 point = new Vector3(x, y, z);
points.Add(point);
}
I can't seem to modify this to be around and not over the point.
z=0? – Kurt G. Jan 04 '23 at 07:49