scripting

Hello !

I spent the whole day trying to understand why what I need to do (which should be pretty simple) seems impossible… I’m sorry if my question seems to be an recurrent one, but I think I’ve read every thread about it without finding a proper answer.

What I’m trying to achieve

  1. Rotate 1 degree of the first Axis
  2. From that position, do a full 360 rotation on the other Axis (so you will rotate back to the same position at 1 Degree out)
  3. Rotate another Degree on the first Axis
  4. From that 2nd degree, rotate the other access 360 degrees again, etc…
    Repeat until you’ve rotated 360 degrees on every single degree rotation of the first axis
    SO that’s the first thing to do
    After that, back from the original position, before anything had rotated on either Axis, zoom the camera in 1 pixel at a time until the screen is almost full with the object in view
    Then, go back out

And that’s the second set of actions

Then, for the third set, keep it back at the original position, and change the brightness down until you can barely see anything, then back up until it’s the brightest, etc…

the 4th set would be the camera flys around the object around all sides, basically, have the camera orbit around
During each of those operations, take screenshots and put them out to a directory as png files.

What have you tried? Have you made scripts and a working program? Have you followed tutorials on how to set up a Unity project?

I’m not entirely sure how to answer your questions without knowing what your level of scripting knowledge is.

But strictly speaking:

  1. Rotation can be done using transform.rotation = Quaternion.Euler(x,y,z). Beware of gimbal locks, though.
  2. Zooming in the camera a pixel at a time doesn’t make much sense if you’re using a perspective camera (at least not without heavy maths involved to approximate what you want).
  3. Fading can either be done by changing the light intensity, or fake it by putting in a transparent UI canvas as a camera overlay.
  4. Fly the camera around by updating its transform.position values, and after moving it, keep it looking at the target using transform.LookAt(target.transform)
  5. Take screenshots using ScreenCapture.CaptureScreenshot (or Application.CaptureScreenshot if using an older version of Unity).
    public void Awake()
    {
        StartCoroutine(Loop());
    }

// removed yields to go ludicrous speed
    public IEnumerator Loop()
    {
        for (int x = 0; x < 360; x++)
        {
            transform.rotation = Quaternion.Euler(transform.eulerAngles + Vector3.right);
            yield return null;
            for (int y = 0; y < 360; y++)
            {
                transform.rotation = Quaternion.Euler(transform.eulerAngles + Vector3.up);
                yield return null;
                for (int z = 0; z < 360; z++)
                {
                    transform.rotation = Quaternion.Euler(transform.eulerAngles + Vector3.forward);
                    yield return null;
                }
            }
        }
    }

Zooming the camera is not done per pixel, but is very simple and I’m sure you can handle it.

Sounds like you’re trying to bake out sprites or something, but for every single angle seems like a complete waste.