- 博客(64)
- 资源 (5)
- 收藏
- 关注
原创 Unity3d 拖拽物体
void OnMouseDrag() { //屏幕空间拖拽 //float distance_to_screen = Camera.main.WorldToScreenPoint(gameObject.transform.position).z; //transform.position = Camera.main.ScreenToWorld
2017-02-28 17:23:39 1292
原创 Unity3d 发布WebGL 并加载AssetBundle
发布webGL平台前,首先要明确几点:1.发布WebGL时不能使用第三方动态库(可以将第三方动态库的使用放置到网页上实现,如连接数据库等操作)2.其次打包时尽量使用AssetBundles实现动态加载,仿真加载时间过长AssetBundle打包(打包时要注意目标平台)using UnityEditor;public class CreateAssetBundle
2017-02-17 10:31:05 14544 5
转载 Winform 拖拽控件
private Point mouse_offset; private void label1_MouseDown(object o, MouseEventArgs e) { mouse_offset = new Point(-e.X, -e.Y);// } private void label1_MouseM
2016-07-22 22:56:52 2203
原创 R 常用函数
#define varible xx <- c(1,9,2,8,3,9,4,5,7,6)#平均值mean(x)#中位数median(x)#方差var(x)#标准差sd(x)#整体统计信息summary(x)
2016-04-04 10:01:52 776
转载 C# WinForm获取当前路径汇总
Winform获取应用程序的当前路径的方法集合,具体如下,值得收藏//获取当前进程的完整路径,包含文件名(进程名)。string str = this.GetType().Assembly.Location;result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)//获取新的Process 组件并将其与当前活动的进程关联的主模块的完整
2015-10-27 11:27:19 2374
原创 Unity3d UGUI 动态加载按钮
static int numPerRow = 5;//每行的按钮个数 static int lineHeight = 60; static float panelWidth = 300; static float panelHeight = 300; public static void ShowSelectPanel(EModelType type) {
2015-09-23 15:51:57 4930
原创 OpenCV 高斯模糊
所谓"模糊",可以理解成每一个像素都取周边像素的平均值void Example2_4(IplImage* image){ cvNamedWindow("in"); cvNamedWindow("out"); cvShowImage("in", image); IplImage* out = cvCreateImage(cvGetSize(image), IPL_DEPTH
2015-06-26 15:20:39 757
原创 OpenCV播放视频,滑动条随帧数动态变化
#include "highgui.h"int g_slider_position = 0;CvCapture* g_capture = NULL;void OnTrackbarSlide(int pos){ cvSetCaptureProperty( g_capture, CV_CAP_PROP_POS_FRAMES, pos); g_slider_posit
2015-06-19 17:20:47 853
转载 Unity3d场景加载进度条
int displayProgress; private IEnumerator StartLoading(int scene) { b_showProgress = true; displayProgress = 0; int toProgress = 0; AsyncOperation op = App
2014-09-25 11:16:12 1233
原创 Unity3d GUI适应分辨率
float sourceWidth = 1024f; float sourceHeight = 768f; float m_fScaleWidth; float m_fScaleHeight; void OnGUI() { m_fScaleWidth = Screen.width / sourceWidth; m_fScal
2014-06-10 16:04:40 1344
原创 Unity3d 读写XML文件
PC端:XmlDocument doc=new XmlDocument();doc.Load(xmlFile);//若使用LoadXml()可能会导致加载失败!(xml文件的编码格式问题)XmlElement xmlNode = doc.createElement("item");xmlNode.SetAttribute("属性名",属性值);doc.DocumentElement.A
2014-03-06 10:22:42 1018
转载 DateTime.Now.ToString()用法
//2008年4月24日 System.DateTime.Now.ToString("D"); //2008-4-24 System.DateTime.Now.ToString("d"); //2008年4月24日 16:30:15 System.DateTime.Now.ToString("F"); //2008年4月24日 16:30
2014-03-05 13:48:45 1725
转载 “failed to update unity web player”失败的问题:
我们使用浏览器加载unity3d文件,不同的网络可能会产生failed to update unity web player的错误,详细信息为:unity web player update finished but installed revision (3578006) is less than required revision (4128001). please rein
2014-03-04 11:08:23 5730
原创 Mac 操作
1.显示、隐藏隐藏文件夹defaults write com.apple.finder AppleShowAllFiles -bool false
2014-03-01 20:55:55 698
原创 Oracle数据库导入导出
(1) 数据库中数据导出l 运行,在其中输入: exp qxj/qxj@oracle file=d:\qxj.dmp(备注:d:\qxj.dmp是备份文件所在路径,用户可自己定义路径),回车后系统出现数据导出界面,(2)数据的导入在命令行中输入splplus,然后输入数据库管理员的用户名和密码,创建一个新的用户,并授权,如图 49所示,为创建了一个名为qxj1的用户,密码为q
2014-02-28 09:22:07 620
原创 The diff between Awake,Start And OnEnable
The order of Awake/Start/OnEnable is :1.Awake first. This function was called when all game object are loaded. note that : this function is called only once since the scene is started.2.OnEnabl
2013-12-24 20:00:17 912
原创 Unity3d 解决文字超出文本框范围
有时文本框中的文字过多会超出文本框的显示范围,影响显示效果。曾经尝试改变字体大小,倒是差强人意。但是,跟整体的风格就不一致了!百度了一下没有找到结果,还是google给力,一个链接就搞定了!Unity3d本身就已经为我们考虑到了这个问题,并且提供了两种解决方案。http://docs.unity3d.com/Documentation/ScriptReference/GUIStyle-clip
2013-12-19 10:52:04 11095 3
原创 Unity3d 倒序播放动画
gameObject.animation["anim"].speed = -1; gameObject.animation["anim"].time = gameObject.animation["anim"].length;gameObject.animation.Play("anim");
2013-12-12 16:42:57 4947
原创 Unity3d 更改UI及物体的透明度
Unity3d 更改UI的透明度动态更改GUI纹理的透明度void OnGUI(){alpha += 0.01f;GUI.color = new Color(1f,1f,1f,alpha);GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),tex);}更改物体的透明度renderer.mate
2013-11-11 11:29:48 19153 1
原创 Unity3d为物体添加/删除脚本
Unity中有些脚本一直处于运行状态,虽然可以使用标准判断是否进行处理,但每次判断仍会消耗一定的CPU运算能力。为了避免脚本占用太多的资源,我们只是在需要的时候将其附加到物体上,一旦操作完成就将脚本从物体上删除。为物体添加脚本的方法如下:GameObject go = GameObject.FindGameObjectWithTag("tagname");go.AddCompon
2013-10-25 16:00:26 8874
原创 Unity3d判断当前编译平台
Platform Dependent CompilationUnity includes a feature named "Platform Dependent Compilation". This consists of some preprocessor directives that let you partition your scripts to compile and exec
2013-10-25 15:10:54 2958
转载 Unity3D深度相机 Depth Camera
作为3D世界里最重要的窗口,摄像机的应用就显得很重要,毕竟在屏幕上看到的一切都得用摄像机矩阵变换得来的嘛。论坛上看到了一篇帖子讲非天空盒的背景做法,让我想起其实很多界面合成画面可以用摄像机之间的交互来实现(避开用GUI,效率问题我没尝试过,但是貌似用深度相机比gui好?以后试验下)。首先说下深度相机,就是用2个或者2个以上的相机,设置好参数后自动到屏幕视觉合成的效果,应用上两个方面:1,背
2013-10-24 10:21:08 1519
原创 Unity3d使用delegate
using UnityEngine;using System.Collections;public class delegateTest : MonoBehaviour { delegate void PrintSomething();//定义委托,注意返回类型和参数 PrintSomething m_print;//定义委托变量(委托是一个数据类型) void St
2013-09-29 10:47:37 1853
原创 Unity3d动态显示/隐藏GUI
using UnityEngine;using System.Collections;public class testTab : MonoBehaviour { private float xpos = 0f; private bool hide = false; void OnGUI() { GUI.BeginGroup(new Rect(xpos
2013-09-27 16:39:39 8582 1
原创 Unity3D GUI绘制折线图
using UnityEngine;using System.Collections;using System;public class DrawLine : MonoBehaviour { public Vector2[] m_point;//特征点位置 public Color m_lineColor; private static Textu
2013-09-27 12:09:47 4246
原创 Unity3d绘制饼状图
using UnityEngine;public class PieChartMesh : MonoBehaviour{ float[] mData; int mSlices; float mRotationAngle; float mRadius; Vector3[] mVertices; Vector3[] mNormals; V
2013-09-26 15:42:03 8016 3
原创 Unity3d学习笔记
1、物体的移动使用 Input.GetAxis,2、通过按键触发事件使用 Input.GetButton ,不要使用 Input.GetButton 处理物体的移动
2013-09-23 10:06:33 686
原创 C#获取CPU、硬盘、Mac地址并使用CPU和Mac地址生成注册码
public static string GetMachineCode() { string machineCode = ""; MD5CryptoServiceProvider provider1; byte[] array1; string text1; st
2013-09-12 09:53:42 1442 1
原创 Unity3d 通过网页下载资源
function Start () { // The sql statement translate to webpage to return a record var sql_text:String = "select * from equipment,image where self_name = '" + self_name + "' and equipment.modelid=i
2013-09-05 09:34:52 1314
原创 Unity3d 从数据库中读取带有换行符的文本
在Unity脚本中可以直接使用带有“\n”转义字符的字符串,使得字符串能够在GUI中显示换行。然而,若是在Unity中使用从数据库中读出的字符串,Unity会将字符串中的转义字符当作普通的字符显示在GUI中,而不会将字符串换行。这时,需要使用下面的语句将从数据库中读出的字符串格式进行转换,使Unity能够正确处理转义字符。content = System.Text.RegularExpress
2013-09-02 13:08:06 5550 1
原创 Unity3d 调用C++写的DLL
1、创建DLL打开VS2010,创建一个win32应用程序,选择创建一个DLL类型的空项目。新建一个头文件和一个源文件。在头文件中写入#if defined (EXPORTBUILD) # define _DLLExport __declspec (dllexport) # else # define _DLLExport __declspec (dllimport)
2013-08-29 14:52:34 1527
原创 Unity3d 去掉exe版本的边框
网上有好多介绍Unity3d去除边框的文章,大都是出自同一个地方。http://www.pixelstudio.nl/?p=204,好多人还让必须用指定的文件名(文件名必须与类名一致)。把网上的代码copy过来实验了一下,结果不能用。so,查找各种资源,最终解决掉了。using System;using System.Runtime.InteropServices;using UnityE
2013-08-27 17:06:16 6566 2
原创 unity3d 帮助引导
/* Author:AndySun * Time:2013/8/19 * Function:Loader Help Image * Version:003 **/using System.Collections.Generic;using UnityEngine;[RequireComponent(typeof(GUITexture))]public class Loa
2013-08-27 09:38:51 1015
原创 unity3d列表分页
using System.Collections.Generic;using UnityEngine;public class Page : MonoBehaviour { public List Tips = new List(); public Texture2D DetailImg1; public Texture2D DetailImg2; priv
2013-08-22 15:39:55 2973 2
原创 Unity3d 地图
using UnityEngine;using System.Collections;public class Map : MonoBehaviour { public GameObject player;//要定位的物体、人物 //设备在地图上的信息 [System.Serializable] public class Equipment {
2013-08-22 10:27:06 1322
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人