Mar
30
2014

[Asset Store] PolygonCollider2D Optimizer

sprite_polygoncollider2D_optiimzer_unity_1

Small tool for sprite PolygonCollider2D optimization (got tired of manually adjusting sprite collider vertices when doing this small ‘game’ for android)
*Main image fruit credit: Fi3uR (CC BY-NC-ND 3.0)

Asset Store Link: https://assetstore.unity.com/packages/tools/sprite-management/polygoncollider2d-optimizer-16605?aid=1101lGti

Unity Forum Link: http://forum.unity3d.com/threads/240534-Released-PolygonCollider2D-Optimizer


Documentation:
PolygonCollider2D_Optimizer_web.pdf

Features:
– Super simple workflow, real results! (increased frame rate, no more “floating colliders”)
– Optimize, Scale, Move, Filter/Remove PolygonCollider2D vertices & paths (for every selected sprite)
– Remove inner paths, Keep only largest path, Remove paths based on vertex count
– Add, Reset, Remove PolygonCollider2D’s (for every selected sprite)
– 4 Scaling modes: Estimate Neighbours, Standard Scaling, Normalized Scaling, Normalized Scaling (local center). *Scaling is useful for avoiding Box2D skin margin problems

Limitations:
– This uses unity generated PolygonCollider2D’s, its not reading the image data at all, those generated polygoncolliders are then optimized
– Not all actions are undoable (see docs), but you can always reset collider to unity

Roadmap/Future ideas:
– feel free to suggest!

Basic Tutorials
“Remove Inner Paths & Optimize”
-Start optimizer from Window / PolygonCollider2D Optimizer
– Select some sprite with PolygonCollider2D from scene  (you should see in the optimizer window how many paths & vertices the collider has)
– Click “Remove inner paths” few times (until all inner paths are removed) / alternatively you could click “Keep biggest path only”
– Set Filter angle to 18 or so (seems good value in most cases)
– Click Optimize (you can click Optimize again, just incase some edge went below this angle on first round)
– And you are done!

Webplayer demos:
Non-Optimized Scene: http://unitycoder.com/upload/demos/PolygonCollider2D_Optimizer_unity_non_optimized1/
Optimized Scene: http://unitycoder.com/upload/demos/PolygonCollider2D_Optimizer_unity_optimized1/

Android .APK demos:
Non-Optimized Scene: MediaFire | DropBox
Optimized Scene: MediaFire | DropBox

Before & After (easy to remove holes)
polygoncollider2d_optimizer_ss_6b

user interface:
polygoncollider2d_optimizer_interface_00

non-optimized scene: (starts to slowdown after 350+ sprites with default polygon colliders)
polygoncollider2d_optimizer_ss_1

Optimized scene: (still running nicely at 600 optimized sprites, starts to dip below 40-50 at ~700 sprites)
* (optimizing workflow: select all objects, click Optimize couple times, click Remove inner paths 3-4 times, click scale twice – Done!)

polygoncollider2d_optimizer_ss_2

polygoncollider2d_optimizer_ss_3

Before scaling (default PolyCollider2D by Unity) || After optimizing & scaling:
polygoncollider2d_optimizer_ss_4

Before and after optimizing (could had scaled it a bit after optimizing though)
polygoncollider2d_optimizer_ss_5


6 Comments + Add Comment

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Github Join Discord Twitch Instagram BlueSky

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.