Unity立体旋转视频大屏互动kinect体感操作
程序员文章站
2022-03-20 22:59:46
最近用unity做了一个旋转视频展示的项目,主要需要用3d的方式展示视频,用kinect来挥动左右手控制视频的旋转然后再上面还有个地方实时播放视频大体上是这个样子using System.Collections;using System.Collections.Generic;using System.IO;using UnityEngine;public class GetAllFiles{ /// /// 获取文件夹里面指定类型的文件...
最近用unity做了一个旋转视频展示的项目,主要需要用3d的方式展示视频,用kinect来挥动左右手控制视频的旋转然后再上面还有个地方实时播放视频
大体上是这个样子
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class GetAllFiles
{
/// <summary>
/// 获取文件夹里面指定类型的文件
/// </summary>
/// <param name="path">文件夹</param>
/// <param name="extens">某种类型</param>
/// <returns></returns>
public static List<string> GetAllfiles(string path, params string[] extens)
{
if (Directory.Exists(path))
{
List<string> addressVideo = new List<string>();//视频地址存储
//获取文件信息
DirectoryInfo direction = new DirectoryInfo(path);
FileInfo[] files = direction.GetFiles("*", SearchOption.AllDirectories);
for (int i = 0; i < files.Length; i++)
{
//过滤掉临时文件
if (files[i].Name.EndsWith(".meta"))
{
continue;
}
for (int j = 0; j < extens.Length; j++)
{
if (files[i].Extension == extens[j])
{
addressVideo.Add(files[i].FullName);
break;
}
}
}
return addressVideo;
}
return null;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ShowText : MonoBehaviour
{
Text text;
Animator animator;
// Start is called before the first frame update
void Awake()
{
animator = transform.GetComponent<Animator>();
text = transform.GetChild(0).GetComponent<Text>();
}
public void SetTextstr(string str)
{
text.text = str;
}
public void ShowTip()
{
animator.SetInteger("show", 2);
text.gameObject.SetActive(true);
}
public void HideTip()
{
text.gameObject.SetActive(false);
animator.SetInteger("show", 0);
}
public void EndOverShow()
{
Debug.LogError("动画播放结束");
}
}
需要定制请访问
https://item.taobao.com/item.htm?spm=a2oq0.12575281.0.0.15d11deb85dnFG&ft=t&id=616168034838
本文地址:https://blog.csdn.net/weixin_39341958/article/details/110137783