-1

I want to have coordinates of places all around of the circle

Debug.Log("Degree: " + Degree);

x = Mathf.Cos(Degree);
y = Mathf.Sin(Degree);

Debug.Log("x: " + x + "   y: " + y);

my outputs are:

Degree: 60
x: -0.952413 y: -0.3048106

Degree: 120
x: 0.814181 y: 0.5806112

Degree: 180
x: -0.5984601 y: -0.8011526

Degree: 240
x: 0.3257813 y: 0.9454452

Degree: 300
x: -0.02209662 y: -0.9997559

Degree: 360
x: -0.2836911 y: 0.9589157

why doesn't this work? simple geomatry I know says this should give me positions of every 60 degree

Max Play
  • 3,717
  • 1
  • 22
  • 39
  • 2
    I think this is a duplicate: https://stackoverflow.com/questions/43641798/how-to-find-x-and-y-coordinates-on-a-flipped-circle-using-javascript-methods – Paul Sinnema Mar 15 '22 at 21:14
  • 3
    Convert degrees to radians before you Sin and Cos – hijinxbassist Mar 15 '22 at 21:37
  • 2
    from the [Mathf.Cos Unity3d documentation](https://docs.unity3d.com/ScriptReference/Mathf.Cos.html) "f The input angle, in radians." – Pac0 Mar 15 '22 at 22:31

1 Answers1

0

As the Pac0 said in the comments

from the Mathf.Cos Unity3d documentation "f The input angle, in radians."

            Degree = (float)((Math.PI / 180) * Degree);

            x = Mathf.Cos(Degree);
            y = Mathf.Sin(Degree);

Edit: Sorry added the code that actually fixed my problem

  • Rather than putting in the comment text, can you please modify your answer and add the proper piece of code which solved your problem? – Durga Prasad Mar 18 '22 at 15:27
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 18 '22 at 15:28
  • Sorry I fixed it now – semih yılmaz Mar 22 '22 at 20:39