A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by Pixelcloud-Games, Mar 14, 2013.
Thanks! Glad you like it!
I need to subtract a polygon from a collider at runtime. Is this possible with 2D ColliderGen? (The player can move a square hole around).
Basically, it's possible, but there is rather a lot of coding involved to make your stuff work.
Sarah from OrbitGames has accomplished to use our framework to create a nice planet-digging-game, see the video [here].
Please see the runtime collider generation documentation page [here] for further info.
Thanks, that's a big help!
2D ColliderGen v2.2 has been released on the Asset Store!
- Multi-Island Editing
Added support for enabling, disabling and changing the outline vertex count of multiple collider islands or holes at once.
- Custom pivot of Unity 4.3 Sprites is now supported in
static sprites and animations.
Moved all menu items from a top-level "2D ColliderGen" entry to "Component - 2D ColliderGen". Motivation was to comply with the official asset store guidelines.
Hope you like it!
I just purchased your asset. I am trying to use it with smooth moves and i clicked on "Add AlphaMeshColliders to BoneAnimation." but it seems to not be picking the correct sprite for each body part? It chose the body parts for the weapon and tried to use the weapon as the sprite for each of the bodyparts. so now the colliders are all wrong for my character since its colliders on its arms and legs are tiny swords and such now.
do i need colliders already placed on the character via smoothmoves? or should i be disabling all of them before I try to use 2d colldier gen
Very good plugin.
I want to buy the plugin but I have a doubt. The plugin supports animation collider for 2D toolkit?
Thanks! 2D ColliderGen is not able to create animated colliders for sprite animations created in 2D Toolkit, it only supports animated colliders for Unity's built-in Sprites. 2D Collidergen will only generate a single Polygon- or Meshcollider for 2D Toolkit sprites.
Hope that helps. Kind regards,
Please check your email, I wrote you some questions a few days ago, regarding your comment that it works with a single atlas and fails with multiple atlasses at the same character. Since I am not able to reproduce the problem, it would help a lot if you could upload a minimal version of your project setup somewhere and drop me a link. Thanks very much for using 2D Collidergen!
This plugin looks interesting. I'm using 2D Toolkit extensively, the deep integration for accurate polygon colliders looks very useful.
The thing that would really sway me to buy this plugin is if it also has the ability to set the points for the custom render meshes that can be used in 2D Toolkit. This is very useful for saving fill rate by cutting away fully transparent pixels. Doing this by hand is time consuming and error prone.
Do you think you could take a look at implementing this? The algorithm would be identical for generating the points, you'd just need to set the verts which shouldn't be that hard seeing as you've already managed to hook into the sprite collection editor and collider system
While building with latest unity 4.6.2,2d collider gen dll file is giving some error in il2cpp stages.
Can you please look into it?
I am using 2DColliderGen on my 2D games. I currently have a problem building the exported project on IOS (Android and PC are ok).
When building on XCode, the compiler complains of unrecognized characters in 2DColliderGen.Runtime.dll.s. The following are some lines of code that may be the causes of the problem:
.long mono_aot_2DColliderGen_Runtime_got - . + 3016,11161
.long mono_aot_2DColliderGen_Runtime_got - . + 3020,11188
Thanks a lot, if someone can help.
Whaa, just noticed that there are three unanswered posts, and I've missed the email-notification (or it's not working any more). Sorry guys for the late replies!!
Thanks for the idea! I fear that I won't be able to implement this feature too soon, since I'm quite busy at the moment, bug-fixes / compatibility tests and the like receive higher priority at the moment.
Thanks very much for the info! I'll look into it and submit a fix as soon as possible!
Thanks for the bug-report! Which version of Unity do you use?
I have hopefully fixed your problem, I've sent you a PM, please check your inbox. The bugfix will be included in the next release.
I am using Unity4.62 pro
Thanks for your response. Hope we can get the new version shortly.
Thanks for your feedback! Please check your inbox.
I've just submitted a Unity5 and IL2CPP / iOS-64Bit compatible package to the asset store.
Funny thing is that the IL2CPP problems that you have encountered in Unity 4.6.2 are already solved when upgrading to Unity version 4.6.3 - but now we're on the safe side for sure.
I am interested with this tool. But i have a question. I use 2dtoolkit and i have collection with sprites that uses different collider settings. Some uses polygon some uses box and some does not need any colliders. Can this tool be applied to only selected sprite in the collection? Looking at the tutorial video it seems like it wants to turn all sprites in the collection to force use the polygon collider at once.
Also, if I can't do a selective generation , then I think it would be too difficult to actually use it because I will lose my previous settings that I have manually done.
Thanks for your interest in our tool!
You can select only those sprites that you wish to edit, then only their colliders will be modified. In fact the tutorial video shows that you can either select multiple (or all) sprites of a collection and generate and edit the colliders simultaneously, or just a single one (e.g. to fine tune the vertex count of individual sprites). If you should happen to change the wrong sprite and override your previous work - the "revert" button in the top-menu of the sprite collection works as usual, also with 2D ColliderGen.
Thus you have all the flexibility and perfect efficiency combined.
Hope this helps.
Is it possible to copy collision setting from one sprite to another (possibly within the same collection but maybe across different collection too)
I have many sprites that needs to have the same collision set ups (shapes and verts setting, not the collection collider depth setting) but having difficult time making them all the same.
-- Edit --
Just figured it out using native 2dtoolkit. It was not very obvious but yes, I found the way. Going to purchase this tool anyway!
Ok, thanks! Glad you figured it out!
Nearly forgot to post it to this forum as well:
2D ColliderGen v2.3 has been released on the Asset Store!
- Unity5 compatible.
- IL2CPP and iOS-64BIT compatible.
- Removed an error console output when changing collider
type between MeshCollider and PolygonCollider2D.
- Removed Warnings.
Hope you like it!
It would be cool to have default alpha opaque threshold value present in the preferences too.
Also, is there other way to open CollliderGen TK window other than going through component -> ...-> ?
There doesn't seem to be any menu item under anywhere else..
I bought your asset long ago, but i didn't use it too much in past months due to a 3D project... I have a question, as i can't remember properly all its functions: is it possible to force a polygon colliders instead of a simply edge one using 2D Toolkit sprite collections? I do need polygons instead of edges because of a lighting script, so i would like to change the type of collider attached to single or multiple sprite (like making a building with complex shapes...). Any tip about this?
Thanks in advance!
Have a nice day.
Not able to compile on iOS. Everything works great on android. But now i'm not able to compile on iOS I have upgraded to Unity 5 and 2D collider Gen 2.3. I have tried importing Collider gen in an completly empty project too and I get the same error. Work with android but not iOS.
Cross compilation job 2DColliderGen_Runtime.dll failed.
UnityEngine.UnityException: Failed AOT cross compiler: /Applications/Unity/Unity.app/Contents/PlaybackEngines/iossupport/Tools/OSX/mono-xcompiler-wrapper.sh --aot=full,asmonly,nodebug,static,outfile="2DColliderGen_Runtime.dll.s" "2DColliderGen_Runtime.dll" current dir : /Users/david/developer/test/Temp/StagingArea/Data/Managed
result file exists: False. Timed out: False
Mono Ahead of Time compiler - compiling assembly /Users/david/developer/test/Temp/StagingArea/Data/Managed/2DColliderGen_Runtime.dll
The class XohwuNyLtIKLPiIScQhvlsNHmhX could not be loaded, used in 2DColliderGen_Runtime, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null
at UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile) [0x000df] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/MonoAssemblyStripping.cs:113
at UnityEditor.MonoCrossCompile.CrossCompileAOT (BuildTarget target, System.String crossCompilerAbsolutePath, System.String assembliesAbsoluteDirectory, CrossCompileOptions crossCompileOptions, System.String input, System.String output, System.String additionalOptions) [0x0033c] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/MonoCrossCompile.cs:318
at UnityEditor.MonoCrossCompile+JobCompileAOT.ThreadPoolCallback (System.Object threadContext) [0x00000] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/MonoCrossCompile.cs:52
Good point, I'll add it in the next release!
You're right! This was based on a rejection by the asset store, previously I had a "2D ColliderGen" section but that was not allowed any longer. I'll add a menu entry to the "Window" section as well.
Thanks for your feedback!
If you are using 2D ColliderGen with 2D Toolkit, then the collider generation and type is in the hands of 2D Toolkit. 2D ColliderGen then only provides the vertices for 2D Toolkit to process them further. So you would need to find the right 2D Toolkit options. However, since you mentionend a lighting script: MeshColliders (or colliders in general) typically don'y have any effect on lighting, except for when your lighting script uses them in a special way. Does your lighting script have any effect when you use a simple box collider? If not, then MeshColliders won't help much..
Have a nice day, too!
Kind regards and HTH,
Thanks for the info!
I'm working on a solution to this problem (I guess it's simply that the dll needs to be built against Unity 5's libraries, which now seem to be binary-incompatible to 4.x and cause the problem).
This problem happens when compiling with player setting "scripting backend" set to "Mono 2.x" instead of "IL2CPP". Since IL2CPP is the preferred (way faster, newer, etc) mode in Unity5, I would heavily recommend using it instead (in the meantime as a fix, and in general for performance reasons ).
Kind regards and HTH,
Great now it works! Thank you so much for your quick reply!
Cool. Also 5 star given and review. Cheers.
Wait , whats the difference between this and the polygon colliders provied in unity 4.6 .
2D ColliderGen v2.4 has been released on the Asset Store!
- Unity5 iOS Mono 2.x compatible again (as well as IL2CPP).
- Added collider preference default values for
alpha threshold, force convex and flip normals.
- Added 'Window' menu entries for Collider Preferences
window and ColliderGen TK2D Window.
Hope you like it!
2D ColliderGen provides
1) additional support for sprite animations - it will generate colliders for each animation-frame and switch them automatically at runtime.
2) more options to quickly change the collider shape (a slider for the outline vertex count, alpha threshold, islands, etc), so you can quickly tweak them instead of manually inserting/deleting points - which is however still possible through the normal Unity interface.
3) many more features (generate MeshColliders as well), see http://pixelcloudgames.com/tools/2d-collidergen
Ohh, got it !
Thanks for your great plugin.
I've managed to use the RuntimeAlphaMeshCollider.cs script to generate a Alpha Mesh Collider at runtime. Can you explain what modifications are required to this script in order to create a PolygonCollider2D at runtime instead of a mesh collider?
Ok, I've had a go at this and created a modified version of "RuntimeAlphaMeshCollider.cs", which I've attached. It seems to work in the most simple cases - but fail on sprites requiring multiple islands - I think I've failed to include code that stitches islands?
I found it hard to bring all the variables in the "TransformReducedOutline" function from "AlphaMeshCollider.cs", so I replaced these with best guess 1.0f, 0f or looked up the current sprites pixels per unit value.
Would appreciate some feedback or comments on the my approach. Thanks - it's been fun trying to work out what's going on in the code, I'm just not quite there yet
I'm making a 2D Beat Em Up game that involves a bit of camera trickery - namely, I've got a camera facing downward at a 45 degree angle with a "floor" coincident with the XZ plane and a "wall" coincident with the XY plane. I'm doing this because, to the camera's perspective, moving up and jumping appear the same, and I'm able to sidestep the colossal pain in the ass that is implementing both jumping and depth in a 2D game. But that's neither here nor there.
The problem I am having is with getting a solid collider around the walkable area of my "floor". These floors could consist of many islands and/or holes. Think of them as platforms. Ideally, I want a controllable character to be able to detect these floors and move along them. With my 3D approach, this is a natural fit.
The only problem is that the colliders don't work when used in this way, and I'm really, REALLY hoping there's a way to fix this because what 2DColliderGen makes is JUST shy of exactly what I need for this problem. If I just generate a collider and make it a Mesh collider, the shape it creates is perfect with respect to my sprite. The problem is that it doesn't actually collide unless the sprite is touching the perimeter - it ONLY collides on the perimeter. If I try to go anywhere on the inside, the sprite just falls right through.
This problem is solved if I make the collider convex - but this introduces a new problem in that the collider no longer conforms to the shape of my walkable area, so I can't use this either.
All I need is for the regular non-convex collider to detect collisions from any direction. The ideal collider is one that takes the shape of my sprite, but is extruded slightly in both directions. This is exactly the shape I get from this non-convex collider. I'm pretty sure the 2DColliderGen is capable of this, but I'll be damned if my tinkering has gotten me anywhere close to figuring this out. If this is in fact something I cannot use 2DColliderGen for, then I would humbly ask that somebody please point me in the right direction for something I can actually use. As for those of you who actually made that add-on, fear not - I will find great use when I add my boundaries and other such details. It's a really awesome and handy tool to have, and I want to thank you all for making it.
I've realized that my previous attempt was utterly a failure - no colliders were being created, at least not be the script, but by Unity as per normal. I've now fixed this up along with some scaling issues. Attached is the latest script (renamed this time).
It appears to create a PolygonCollider2D at runtime - I've hardcoded it to create 1 currently.
Sorry for having missed your posts for so long! In the future please send me an email whenever you don't get a reply a few days later.
(Now I finally understand why I don't get some of the notifications: got an email notifying me of a new message "Ohh, got it !", did not check the forum since it's in the mail already - notification system thinks I'm not interested in the thread and does not notify me after that.)
Don't spend any more time on it - I'll create an updated script that generates PolygonColliders for you. Hope this makes up for stressing your patience.
Sorry as well for not responding for so long!
Unfortunately, the problem is well known and cannot be solved easily. What would be required is to generate the cap-faces on top and bottom of the collider (instead of only generating the 'fence') which would require a whole different (additional) algorithm to split the outline into convex parts and triangulate them. The top- and bottom cap-faces are added automatically by Unity when the collider is set to "convex", in the concave case nothing is generated unfortunately.
I'm sorry that I cannot provide a quick solution here. Is it possible for you to split the ground into convex parts beforehand? Then this would be the easiest precise solution.
I have now created a much more powerful version of the RuntimeAlphaMeshCollider.cs script.
It now supports
provides a scale attribute and can automatically detect sprite-scale
and supports holes (sea regions), previously it generated only islands.
Will be included in the next update, you can download it now from the attachment.
Hope you like it!
Just wanted to say thanks for the great work, I just purchased it today after debating it all day since I've been disappointed with quite a few various assets I've purchased, and I'm really amazed at how simple it was to get frame-by-frame collision for my enemy sprites,
Really great asset!
P.S. It's a minor issue, since I can do it manually, but I'm using a Platformer controller which uses a kinematic rigidbody, but requires a BoxCollider2D as the collider. So for all my calculations, the polygon colliders your asset generates have to be set as Triggers.
Could this be added as an option in the Alpha Mesh Collider script to generate as Triggers? (If there's not something to handle my kind of case already, I haven't dug into the asset too deep yet, something for tomorrow!)
Thanks so much for your kind words, very glad that you are happy with 2D ColliderGen !
Indeed, there is no 'automatically set collider to trigger' functionality yet, but I'll add this to the next release! It's not much of an effort, but haven't thought of this before - combined with a user-defined default parameter this definitely saves some work!
Thanks for your feedback!
Great, thanks a lot!
Im evaluating need for this plugin and i have one question, that i couldnt found answered here.
Is there a chance that animated colliders will be available for 2dToolkit?