Skip to content

Instantly share code, notes, and snippets.

@BichengLUO
Created June 7, 2016 07:11
Show Gist options
  • Save BichengLUO/0cd67907e16220f1259033e308437103 to your computer and use it in GitHub Desktop.
Save BichengLUO/0cd67907e16220f1259033e308437103 to your computer and use it in GitHub Desktop.
A simple Unity3D script for generating 7 pics (1 key frame and 6 flow frames)
using UnityEngine;
using System.Collections;
using System;
public class OneAngle : MonoBehaviour {
public int shotCount;
public int radius = 5;
public Quaternion initialRotation;
public Vector3 initialPosition;
public float totalAngle;
// Use this for initialization
void Start () {
initialRotation = transform.rotation;
initialPosition = transform.position;
transform.Translate(Vector3.forward * radius);
Application.CaptureScreenshot(String.Format("{0}.png", shotCount.ToString("D3")));
}
// Update is called once per frame
void Update () {
if (Input.anyKeyDown && shotCount < 6)
{
transform.rotation = initialRotation;
transform.position = initialPosition;
transform.Rotate(Vector3.forward, 60 * (shotCount + 4));
transform.Rotate(Vector3.right, 1);
transform.Rotate(Vector3.forward, -60 * (shotCount + 4));
transform.Translate(Vector3.forward * radius);
shotCount++;
Application.CaptureScreenshot(String.Format("{0}.png", shotCount.ToString("D3")));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment