L
L
LoliDeveloper2021-09-17 20:29:26
C++ / C#
LoliDeveloper, 2021-09-17 20:29:26

What is wrong with trigonometry in unity or is it C# to blame?

I fill the array with cosines of different angles, and got to the point that this place just hangs and eats RAM to infinity.

for (int i = 0; i < countDisperce; ++i)
        {
            cosinuses[i] = (Mathf.Cos(i * 2 * Mathf.PI / countDisperce));
        }

Hangs even when just When I put it just everything is okay. What's wrong with trigonometry in Unity? UPD : Hangs even with System.Math.Cos() cosinuses[i] = (Mathf.Cos(2));
cosinuses[i] = i/countDisperce;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Griboks, 2021-09-17
@LoliDeveloper

Everything works correctly . Look for the error elsewhere.
You may have messed up with the types or the loop counter, so you have an infinite loop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question