I really need help, I am trying to make this 3D animation by code https://www.youtube.com/watch?v=XLjnTgXXgXk I have tried whith transform, translate, vectors3, quaternion and I am really lost, this is what I have now : Create Thread Unity Forum - YouTube but I dont know how to make the line follow the green ball without moving from the blue point. I will be very grateful for your help my code : greenball.transform.position = new Vector3(center.x + a * Mathf.Cos(alpha), 0, center.z + b * Mathf.Sin(alpha));``redline.transform.Rotate(new Vector3(0, -5, 0), Space.World);The red line is child of the blue point.
[SerializeField] Transform greenball = null;
[SerializeField] Vector3 center = Vector3.zero;
[SerializeField] float a = 3;
[SerializeField] float b = 1;
[SerializeField] float timeScale = 10;
const float tau = Mathf.PI * 2f;
void Update ()
{
float alpha = ( Time.time * timeScale ) % tau;
Vector2 localPosition2d = new Vector2{
x = Mathf.Cos(alpha) * a ,
y = Mathf.Sin(alpha) * b
};
greenball.position = center + new Vector3{ x=localPosition2d.x , z=localPosition2d.y };
}
I work with Line Renderer I put the green ball as the destination of the line renderer and it worked correctly. Ellipse Animation by code Unity Forum - YouTube