



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1新建一个renderTexture命名为minmapTexture新建一个fps角色2、新建一个cmeraFollow脚本并付给摄像机。using UnityEngine;using System.Collections;public class cameraFollow : MonoBehaviour public Transform target;void LateUpdate () transform .position =new Vector3 (target .position.x,transform .position .y,target.position .z);3target为fps,并将摄像机的dipth改为14、给地形一个标签命名为ninmap5、将所有的culling target 改为minmap将main camera 的target texture 改为minimap。6、新建一个plane 将minmaTexture托给他会制动生成一个minmapTexure 材质7新建一个shader 命名为maskShade8 把里面的脚本删除了然后再粘贴如下脚本。Shader Custom/Mask Properties _MainTex (Main Texture, 2D) = white _Mask(Mask Texture, 2D) = white SubShader Tags Queue=Transparent Lighting OnZwrite offBlend SrcAlpha OneMinusSrcAlphaPassSetTexture_Maskcombine textureSetTexture_MainTexcombine texture ,previous9、在photoshop中绘制你要的地图形状并保存alpha通道保存为tag格式。并且注意要修改它的textureType为advant 并且把aphaformgrayScale勾选。】10、选中生成的材质shader菜单下的mask 把从ps中绘制的地图现状拖过去即生成了小地图。11、如果看不到小地图就调节总摄像机下的normalized View port Rect改为 x:0 y:0,w:1, H:1 12下面在游戏中生成小地图。13新建一个c#脚本输入如下代码using UnityEngine;using System.Collections;public class guiTexure : MonoBehaviour public RenderTexture minmapTexture;public Material minmapMaterial;/void OnGUI () if( Event.current.type=EventType.Repaint )Graphics .DrawTexture (new Rect(0,0,256,256),minmapTexture, minmapMaterial);13将他拖到任何一个物体上using UnityEngine; minmapTexture;为minmapTexture minmapMaterial为生成的minmapTexture材质运行一下小地图出来了哈哈很好玩赶快试一下吧方法2:script ExecuteInEditMode()public var Enemy_ : Texture; /define enemy texturepublic var Box_:Texture;/define the box texturepublic var Player_:Texture;/define player texturepublic var radarBG : Texture; /small map texturepublic var centerObject : Transform; /chracter positionpublic var mapScale = 0.3; /地圖縮放public var mapCenter = Vector2(50,50); /地圖中心function OnGUI () bX=centerObject.transform.position.x * mapScale; bY=centerObject.transform.position.z * mapScale; bX=centerObject.transform.position.x * mapScale; bY=centerObject.transform.position.z * mapScale; GUI.DrawTexture(Rect(mapCenter.x-55,mapCenter.y-50,128,128),radarBG); / 上面的mapCenter.x-32是地圖的x位置,mapCenter.y-32是y位置,64,64是地圖的大小 DrawBlipsForEnemies(); DrawBlipsForPlayer(); DrawBlipsForBox();function DrawBlipsForBox() /draw box texture in small map var gos : GameObject; gos = GameObject.FindGameObjectsWithTag(Box); var distance = Mathf.Infinity; var position = transform.position; for (var go : GameObject in gos) drawBlip(go,Box_); function DrawBlipsForPlayer() /draw player texture in small map var gos : GameObject; gos = GameObject.FindGameObjectsWithTag(Player); var distance = Mathf.Infinity; var position = transform.position; for (var go : GameObject in gos) drawBlip(go,Player_); function DrawBlipsForEnemies() /draw enemy texture in small map var gos : GameObject; gos = GameObject.FindGameObjectsWithTag(Enemy); var distance = Mathf.Infinity; var position = transform.position; for (var go : GameObject in gos) drawBlip(go,Enemy_); function drawBlip(go,aTexture) /draw position in small map centerPos=centerObject.position; extPos=go.transform.position; dist=Vector3.Distance(centerPos,extPos); dx=centerPos.x-extPos.x; dz=centerPos.z-extPos.z; deltay=Mathf.Atan2(dx,dz)*Mathf.Rad2Deg - 270 - centerObject.eulerAngles.y; bX=dist*Mathf.Cos(deltay * Math
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 采购单项合同
- 口罩订购合同
- 上海市人民医院带教全科医学学员能力考核
- 欺诈签订的合同
- 石家庄市人民医院眼科检查设备校准考核
- 签了二手房房产买卖合同
- 室外装修合同
- 广东学徒制劳动合同
- 2025第三人民医院内镜中心住院医师培训考核
- 考点攻克苏科版九年级物理上册《简单机械和功》定向测评练习题(含答案详解)
- 2025下半年新疆维吾尔自治区地质局招聘事业单位人员151人考试模拟试题及答案解析
- 2025博士考试历年真题及答案
- 2025年IPA国际注册对外汉语教师资格认证考试真题卷及答案
- 乌兰县公安局2025年面向社会公开招聘警务辅助人员考试参考题库及答案解析
- 财政和金融知识课件
- 2025年盐湖提锂技术成本降低与产能提升产业链分析报告
- 宜宾五粮液股份有限公司2025年下半年社会招聘考试参考题库及答案解析
- 2025年成人高考政治试题及答案
- 2025成人高考政治试题及答案专升本
- ISO 22003-1:2022《食品安全-第 1 部分:食品安全管理体系 审核与认证机构要求》中文版(机翻)
- 牧场物语-矿石镇的伙伴们_完全攻略
评论
0/150
提交评论