Microsoft MakeCode

C# to MakeCode

Hi, so I’ve been using unity and C# for some time now and I used to make bolls with some code.
this is an example:

        for (int i = 0; i < numPoints.Length; i++)
            float t = i / (numPoints.Length - 1f);
            float inclination = Mathf.Acos(1 - 2 * t);
            float azimuth = speed * Mathf.PI * turnFraction * i;

            float x = Mathf.Sin(inclination) * Mathf.Cos(azimuth);
            float y = Mathf.Sin(inclination) * Mathf.Sin(azimuth);
            float z = Mathf.Cos(inclination);

            numPoints[i].transform.position = new Vector3(x * distanceMultiplier, y * distanceMultiplier, z * distanceMultiplier);

numPoints is an array of objects.
speed is just a float,
turnFraction is a float
and DistanceMultiplier is a float too.

Does anyone know how to transform this code in to MakeCOde/java?

1 Like

Well I’m no professional but here is what I would do:

There is no built in Vector3 class so I just added one
and I’m not sure what object numPoints is so just made it a Vector3[]

Hope this helps!