03 2015 档案

unity, 让主角头顶朝向等于地面法线(character align to surface normal)
摘要:计算过程如下:1,通过由主角中心raycast一条竖直射线获得主角所在处地面法线,用作主角的newUp。注:一定要从主角中心raycast,而不要从player.transform.position,因为如果player的模型原点在脚上,则player.transform.position可能就在地... 阅读全文

posted @ 2015-03-31 12:48 wantnon 阅读(2838) 评论(0) 推荐(1) 编辑

unity 在Game视图中显示Gizmos
摘要:自己画的Gizmos要想在Game视图中能看到,需要把Game视图窗口右上角的"Gizmos"按钮点下去。如图:比如,下面代码以角色的capsuleCollider中心为中心画一个半径为0.8f的球体线框。voidOnDrawGizmos(){Vector3capsuleColliderCenter... 阅读全文

posted @ 2015-03-30 22:57 wantnon 阅读(6765) 评论(0) 推荐(0) 编辑

unity Transform.TransformPoint
摘要:正如unity api文档所说:Transformspositionfrom local space to world space.即Transform.TransformPoint是将局部坐标点转化到世界空间(而不是父空间)。至于如何 高效 地将局部空间坐标转到父空间,还没找到。在论坛发了个帖子:... 阅读全文

posted @ 2015-03-30 22:09 wantnon 阅读(1108) 评论(0) 推荐(0) 编辑

unity Input.GetAxis和Input.GetAxisRaw
摘要:float h = Input.GetAxis("Horizontal") ;//h range from -1 to 1float v = Input.GetAxis("Vertical") ;//v range from -1 to 1float h = Input.GetAxisRaw("Ho... 阅读全文

posted @ 2015-03-29 20:21 wantnon 阅读(1792) 评论(0) 推荐(0) 编辑

unity update与fixedUpdate
摘要:update与渲染同步。fixedUpdate与物理同步。在update中,speed要乘以Time.deltaTime。在fixedUpdate中,speed要乘以Time.fixedDeltaTime。参考:http://blog.csdn.net/alexander_xfl/article/d... 阅读全文

posted @ 2015-03-29 20:00 wantnon 阅读(318) 评论(0) 推荐(0) 编辑

unity 获得父子节点
摘要:与常识不同,unity中获得父子节点需要通过transform。即先获得父/子节点的transform,然后再通过父/子节点的transform获得父/子节点。获得父节点gameObject:GameObject parentGameObject=transform.parent.gameObjec... 阅读全文

posted @ 2015-03-29 13:06 wantnon 阅读(1646) 评论(0) 推荐(0) 编辑

3dmax坐标系与导出fbx的坐标系
摘要:3dmax和opengl都是右手坐标系,但是3dmax是z轴向上,而opengl中是Y轴向上。如图:所以在3dmax的fbx导出对话框中有“轴转化”一项,可以设置“Y向上”或者“Z向上”。默认是“Y向上”,这样导出以后再加载到opengl程序里,模型就不至于是“躺着”的了。不过这个“轴转化”的原理只... 阅读全文

posted @ 2015-03-27 20:20 wantnon 阅读(8320) 评论(0) 推荐(0) 编辑

unity 在脚本B中调用脚本A的函数
摘要:一,在脚本B中调用脚本A的函数。脚本A://myFuncs.csusingUnityEngine;usingSystem.Collections;namespacemyFuncs{publicclassCmyFuncs{publicstaticvoidprintHi(){Debug.Log("Hi"... 阅读全文

posted @ 2015-03-25 19:52 wantnon 阅读(492) 评论(0) 推荐(0) 编辑

unity5 Orthographic模式相机视截体尺寸计算
摘要:一,通过编辑器中数值计算。如图,相机为Orthographic模式,其camera size为5.57,是什么含义呢,经过测量,发现视图中视截体的高度是5.57x2。那么视截体的宽度怎么决定呢?做下面试验,前面屏幕尺寸选的是Web(600x900),所以 视截体宽度=视截体长度/900*600=7.... 阅读全文

posted @ 2015-03-25 14:05 wantnon 阅读(5910) 评论(0) 推荐(1) 编辑

unity5 新建球体的默认半径是0.5
摘要:unity5 新建球体的默认半径是0.5 阅读全文

posted @ 2015-03-25 13:22 wantnon 阅读(693) 评论(0) 推荐(0) 编辑

unity5 Edit Collider
摘要:按下Edit Collider按钮,视图中Collider线框中出现控制点,可以通过拖动控制点对Collider进行调整。 阅读全文

posted @ 2015-03-24 00:03 wantnon 阅读(1068) 评论(0) 推荐(0) 编辑

unity 查看prefab层次
摘要:点那个箭头,可以展开: 阅读全文

posted @ 2015-03-23 23:16 wantnon 阅读(1032) 评论(0) 推荐(0) 编辑

unity c# script error CS0664: Literal of type double cannot be implicitly converted to type `float'. Add suffix `f' to create a literal of this type
摘要:例如在unity c# script中定义private float x=0.0;则会报error CS0664: Literal of type double cannot be implicitly converted to type `float'. Add suffix `f' to cre... 阅读全文

posted @ 2015-03-23 22:09 wantnon 阅读(598) 评论(0) 推荐(0) 编辑

unity hide/show text
摘要:usingUnityEngine;usingSystem.Collections;publicclassPlayerController:MonoBehaviour{publicUnityEngine.UI.TextwinText;voidStart(){winText.text="YouWin!"... 阅读全文

posted @ 2015-03-23 21:59 wantnon 阅读(470) 评论(0) 推荐(0) 编辑

unity5 创建material
摘要:在material文件夹下unity5中新创建的material默认如下开始我不知道贴图应该加在哪儿。于是跳过教程上这一步,直接去选shader:在这个shader下很明显看到加贴图的地方了:加完贴图如下:假如此时再回到默认的Standard shader下,可以看到:原来Albedo前面的方格是加... 阅读全文

posted @ 2015-03-23 17:03 wantnon 阅读(1583) 评论(0) 推荐(0) 编辑

unity输出log
摘要:Debug.Log("..."); 阅读全文

posted @ 2015-03-23 14:03 wantnon 阅读(204) 评论(0) 推荐(0) 编辑

unity5 where is "Edit->Render Settings"?
摘要:The Render Settings logic has changed a bit. To find the settings you will need to go to "Windows->Lighting" and go to the Scene tab, There you will f... 阅读全文

posted @ 2015-03-23 12:07 wantnon 阅读(484) 评论(0) 推荐(0) 编辑

unity save layout
摘要:调整完布局,点Save Layout,并命名,就得到一个新的layout,以后可以直接在下拉菜单中选择并切换到此布局。 阅读全文

posted @ 2015-03-23 11:01 wantnon 阅读(398) 评论(0) 推荐(0) 编辑

unity 设置屏幕尺寸
摘要:在PlayerSettings中将web player的screen size设成600x900后,需要在Game视图下拉菜单中选Web(600x900),Game视图才能显示成我们设定的尺寸。 阅读全文

posted @ 2015-03-23 10:49 wantnon 阅读(6671) 评论(0) 推荐(0) 编辑

unity, mesh Collider
摘要:关闭mesh Renderer以便查看mesh Collider"For Unity 5, we must also select "Convex" on the Mesh Collider, in order for the Mesh Collider to work correctly with... 阅读全文

posted @ 2015-03-23 10:09 wantnon 阅读(819) 评论(0) 推荐(0) 编辑

unity5 Text
摘要:unity5中,添加Text对象:在其它对象的脚本中如果想引用此Text,则应定义:public UnityEngine.UI.Text myText;然后把对象拖到变量上即可。注:1,需要注意的是,如果写成:public GUIText myText;则把对象拖到变量上时是不认的。GUIText是... 阅读全文

posted @ 2015-03-22 17:49 wantnon 阅读(607) 评论(0) 推荐(0) 编辑

unity3d 通过添加rigidBody来指明物体是动态的,以避免cache开销
摘要:unity3d 通过添加rigidBody来指明物体是动态的,以避免cache开销。如果不添加rigidBody,则unity会认为它是静态的,会对物理计算进行cache,但如果此物体实际上transform一直在发生变化,则unity会不断更新cache,结果反而不如指明其为动态物体效率高。 阅读全文

posted @ 2015-03-22 14:27 wantnon 阅读(294) 评论(0) 推荐(0) 编辑

unity3d prefab
摘要:用prefab创建的实例,其position/rotation/scale并不会随prefab的position/rotation/scale修改而更新,其它属性才会。不过如果prefab的某个实例a,通过Apply修改了prefab的position/rotation/scale,则此实例a的po... 阅读全文

posted @ 2015-03-21 20:32 wantnon 阅读(348) 评论(0) 推荐(0) 编辑

object-c 获得目录(包括子目录)下所有文件和文件夹路径
摘要:void getAllPathNameInDirectory(vector&filePathList,vector&directoryPathList){ NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease]... 阅读全文

posted @ 2015-03-19 17:22 wantnon 阅读(921) 评论(0) 推荐(0) 编辑

texturePacker黄色文件夹和蓝色文件夹
摘要:texturePacker中以黄色文件夹添进来的文件夹中的图片,不用带文件夹名,以蓝色文件夹添进来的文件要带文件夹名。 阅读全文

posted @ 2015-03-16 16:23 wantnon 阅读(368) 评论(0) 推荐(0) 编辑

自定义相机下使用clippingNode注意事项
摘要:调用完clippingNode->setCameraMask(myCameraMask)后,还需要clipNode->getStencil()->setCameraMask(myCameraMask)。也就是说:虽然1,当为父节点设置cameraMask后子节点会被自动设成相同的cameraMask... 阅读全文

posted @ 2015-03-16 13:14 wantnon 阅读(363) 评论(0) 推荐(0) 编辑

cocos2dx 3.3多相机下_transformUpdated bug
摘要:uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags){ if(_usingNormalizedPosition) { CCASSERT(_parent, "setNormali... 阅读全文

posted @ 2015-03-16 13:12 wantnon 阅读(497) 评论(0) 推荐(0) 编辑

一定不要在头文件中using namespace XXX
摘要:一定不要在头文件中using namespace XXX,这样会造成名字空间污染,引发ambiguous错误,又难以定位。 阅读全文

posted @ 2015-03-13 15:15 wantnon 阅读(325) 评论(0) 推荐(0) 编辑

cocos2dx 3.3将坐标由父空间转化到局部空间
摘要:设在node的父空间内有一点p,要求其转化到node局部空间后的坐标p_local,代码如下:node->getNodeToParentTransform();//in order node->parentToNodeTransform() got right result, we must cal... 阅读全文

posted @ 2015-03-11 17:31 wantnon 阅读(239) 评论(0) 推荐(0) 编辑

cocos2dx 3.3 getParentToNodeTransform bug
摘要:cocos2dx 3.3中getParentToNodeTransform实现如下:const Mat4& Node::getParentToNodeTransform() const{ if ( _inverseDirty ) { _inverse = _transform.getInve... 阅读全文

posted @ 2015-03-11 16:19 wantnon 阅读(940) 评论(0) 推荐(0) 编辑

cocos2dx 3.x designResolutionSize须主动设置
摘要:cocos2dx 3.x最初设置screenSize和designResolutionSize的地方如下:bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Dire... 阅读全文

posted @ 2015-03-11 12:38 wantnon 阅读(735) 评论(0) 推荐(0) 编辑

getXXXPos()约定
摘要:class CmyNode:public CCNode{public: CmyNode(){ m_XXX=NULL; } virtual~CmyNode(){ } bool init(){ m_XXX=CCSprite::create("xxx.png"); addChi... 阅读全文

posted @ 2015-03-10 13:27 wantnon 阅读(230) 评论(0) 推荐(0) 编辑

FBX BlendShape/Morph动画解析
摘要:目前fbx 2015.1中支持三种变形器:skinDeformer,blendShapeDeformer,vertexCacheDeformer。定义在fbxdeformer.h中:enum EDeformerType { eUnknown, //!GetName()得到通道名称.targetSh... 阅读全文

posted @ 2015-03-02 02:41 wantnon 阅读(11859) 评论(3) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示