unity3d 的2Dunity 2d sprite 平铺的 Polygon2D都不能自己调节吗

Unity官方意识到在4.3版本之前,并没有自带的支持2D游戏工具,商店里面有很多有名2D插件Uni2D,2DToolkit,在4.3版本之后就出现UISprite精灵来支持2D游戏开发,我用这个很多次了.现在才知道它就是Unity原生2D,用起来应该是没有Uni2D方便的,=。=实际开发大家应该不习惯这个 & Unity2D中文介绍地址 &&& Unity2D经典的教程文章,还有单位的转换 总体功能介绍: &&&&&&& 1. 支持分割图片,把一张完整的游戏图,分割成很多小块 &&&&&&& 2. PackingTag把多个图片,打成一个包减少Drawcall &&&&&&& 3.支持动画状态机 下面就是2DSprite属性图 & 分割图片: 如果你想把一张图片分割出多个小图片,用来做序列帧动画. SpriteMode=Multiple,然后再点击SpriteEditor进去就可分割图片啦. (你分割之后Unity只是创建一个文件来记录有哪些图片,哪些坐标,并不是真正分割出一张张小图片在本地保存) 下面是SpriteEditor编辑器,有两种分割模式: Automatic自动分割,Grid网格分割,点击Apply就可以保存分割的状态了.
分割好的小图片(小图片并不真实存在!)你可以选中几个拖进Hierarchy视图中,Unity会询问你是否创建状态机和帧动画
选中游戏物体Windows –》 Animation中就可以动画编辑器,点击运行你就可以看见人物的行走啦
& PackingTag把多个图片,打成一个包减少Drawcall: Edit –& projection Settings –& Edit中设置 SriptePacker设置成AlwaysEnabled. 默认是关闭的,你想把一些图片打成一个包填写相同的名字. 打开Game视图State查看Draw Calls查看是否减少了, 在Windows-&Sprite packer打开窗口可以查看你打了多少个精灵包
阅读(...) 评论()温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
我是阿赵,请多多指教!
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
其实这个功能要自己写也不难的,只是把各个sprite上的图片做copy pixel处理,然后计算一个矩形范围,把所有拾取的图片像素按一定的规律放在一张图片上面。不过这些较为底层的东西很多人都会害怕而选择逃避,所以有很多直接可以用的工具,比如NGUI的较新版本就有这个自动图集的功能了,或者有很多图集制作的软件。 Unity3d在推出2D功能的同时,也附带了这个制作图集的工具,也就是Sprite Packer了。下面简单的介绍一下它的用法:在使用这个功能之前,我们先要到editor setting里面把Sprite Packer打开:&然后打开sprite packer的窗口:&这个就是sprite packer的窗口了,主要的操作,其实就是左上角的这个pack的按钮了。不过现在我们按这个按钮,不会有任何东西出现。&在我们的项目文件夹里面,我放了几个已经做好切割的sprite&选择这些sprite,把属性里面的Packing Tag输入一个名字。这里我所有sprite都输入了enemys:&现在再来点pack按钮,就会出现了东西了。这就是把刚才那对sprite拼起来的图集了。&假如我们把主角土豆人的Packing Tag改成players(或者其他和之前不一样的名字)&我们再来pack,就会看到,土豆人在图集里面消失了。在这个图集选择里面,我们可以看到刚才新增加的players类别:&选择players,又看到土豆人了。这是因为这个sprite packer做图集是根据Packing Tag标签来做的,它会把同样标签的物体分成一类,然后制作。实际上我们能做的操作真的不多,这个过程是自动完成的。完成之后,我们在项目面板下面选择sprite,在图集里面相应的sprite会变成高亮显示。&& 既然这个功能是这样自动化,那为什么一开始是禁用状态,需要我们手动去editor setting里面设置打开呢?原因是这个功能在unity打开工程的时候会先花一些时间运算图集,如果你需要计算的sprite很多,那么打开就会慢一些。计算好的图集会放在缓存文件夹Project\Library\AtlasCache里面,如果把这里的内容删掉,那么unity将会再次运算图集。然后如果选择了制作图集,那么sprite的原图就不会经过压缩以便拾取像素制作图集了。&
阅读(22445)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Unity3d的Sprite Packer用法介绍',
blogAbstract:'\t之前有人留言说想我介绍一下sprite packer的用法。那么我也顺便的介绍一下吧。\t我们用来做sprite 的图片,通常会留有很多空白的地方,我们在画完了sprite之后,这些地方很可能就没有什么作用了。如果想避免这些资源上的浪费,我们可以把各个sprite做成图集,把图片上的空间尽量利用得充实一点。这时候,我们就需要一个制作图集的工具。\t其实这个功能要自己写也不难的,只是把各个sprite上的图片做copy pixel处理,然后计算一个矩形范围,把所有拾取的图片像素按一定的规律放在一张图片上面。不过这些较为底层的东西很多人都会害怕而选择逃避,所以有很多直接可以用的工具,比如',
blogTag:'unity3d,sprite,packer,spritepacker,图集',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:3,
publishTime:4,
permalink:'blog/static/',
commentCount:11,
mainCommentCount:5,
recommendCount:4,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'我是阿赵,请多多指教!',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}unity3d - Can a Polygon Collider 2D work with a Mesh Collider in Unity? - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 7.0 million programmers, just like you, helping each other.
J it only takes a minute:
EDIT: This is now a rather simple question. I have a 2D sprite that really needs the precision of a polygonal hitbox. The 2D, tile-based world around it uses a tile Mesh for efficiency reasons, and thus has a Mesh Collider.
Before, the tiles in the world were each GameObjects with Box Colliders and Rigidbody 2D's, and the ship and the tiles collided just fine. Now that I am using a Mesh Collider, however, they cannot collide. (I have read that this is because one is 2D and one is 3D.) So what should I do to get collisions (preferably with rigidbody physics) between a polygonal ship and a 2D tile mesh? [end edit]
In a 2D, tile-based, procedurally-generated, chunk-based exploration game (in Unity 4.5), I have a player ship which uses a Rigidbody 2D and a Polygon Collider 2D for collision detection.
This worked fine back when I used a Rigidbody 2D / Box Collider 2D for world tiles. However, this is horribly slow, so I replaced the discrete blocks with a tile mesh, using a Mesh Collider and other associated paraphernalia.
The problem is: I simply cannot get collision detection to work. I have tiles on the x-y plane, and the collision mesh (I can see it in the Scene View, so I know it works) consists of four rectangles perpendicular to the tile. (If you can't visualize this, I don't blame you. See .)
What have I looked at so far? Well, I verified that the (2D) ship actually passes through the collision boxes in the Scene View. Also, neither of the colliders "Is Trigger".Since there seems to be no official documentation on how to actually use meshes (is there? Where?), I can't find out whether Mesh Colliders and Polygon Colliders actually can interact. Because one is 2D and one is 3D, does this not work? If so, then what should I do instead? I tried using a Box Collider [3D] for the ship, but this didn't work either. I could have potentially made a mistake here, though.
Am I supposed to handle the collision manually (with the OnCollisionEntered [or something] method)? Before, the rigidbody2D objects handled everything automatically. Otherwise, is there any other possible reason the collision might not work?
Well, I'm quite disappointed there seems to be no built-in way to do this in Unity. My solution was to attach a GameObject to the player that would read the block data from the world and create (pooled, of course) real but invisible "collider blocks" with Box Colliders 2D in a small area around the player, such that the player could collide with blocks near them. It works great, and I also implemented an algorithm to spawn rectangular collider blocks o this eliminates the "ghost pixel" bug in the 2D physics engine.
Uni2D plugin () automatically creates 3d colliders (as a group of mesh colliders) from any 2 texture with transparency. A bit expensive but works.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
rev .25660
Stack Overflow works best with JavaScript enabled

我要回帖

更多关于 unity2d sprite 图片 的文章

 

随机推荐