
File -> New Scene
File -> Save Scene as ... -> Sample03.unity
上部のメニューから「Assets」-> 「Create」 -> 「C# Script」 -> ファイル名は Sample03
| Sample03.cs |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sample03 : MonoBehaviour {
public GameObject target;
NtUnity.Kinect nt;
Texture2D texture;
void Start () {
nt = new NtUnity.Kinect();
texture = new Texture2D(NtUnity.Kinect.rgbCols,
NtUnity.Kinect.rgbRows,
TextureFormat.RGBA32,false);
}
void Update () {
nt.setRGB();
texture.SetPixels32(nt.rgbImage);
texture.Apply();
target.GetComponent<Renderer>().material.mainTexture = texture;
// rotate cube
target.transform.rotation = Quaternion.AngleAxis(Mathf.Rad2Deg * Time.time,
Vector3.up);
}
void OnApplicationQuit() {
nt.stopKinect();
}
}
|
上のメニューから -> GameObject -> 3D Object -> Cube


上のメニューから -> GameObject -> Create Empty




Cubeは 約6.3秒 (2π秒)でy軸回りに一周します。
Runtime Video UnityDLL02.mp4
