Search Unity

[RELEASED 1.2.5] Smart Slicer Pro 2D

Discussion in 'Assets and Asset Store' started by Qzia, Feb 7, 2018.

  1. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    I have sent you the package. The Scene is called "Thin Slice".
    The ball movement can be Unity Physics based, but I liked how oldschool method worked out.

    If you have any questions, I'm forward to answer them.
     
  2. JovicaTT

    JovicaTT

    Joined:
    Feb 21, 2018
    Posts:
    6
    Great asset!
    Quick question. Is it possible to have 2 joints attached to the same object, slice it, and have 2 slices appear each with their respective joint still attached? I haven't been able to get it to work. It just keeps one of the joints, and basically it's always the first one, while the other gets detached and the slice just falls.

    Thanks, Jovica.
     
  3. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @JovicaTT I've just updated Slicer2DAnchor component to support multiple colliders.

    Replace original code with this:
    https://pastebin.com/J2PQ1uGu

    Use one script to attach multiple objects.

    Demo Video:
     
    Last edited: Aug 14, 2018
    JovicaTT likes this.
  4. JovicaTT

    JovicaTT

    Joined:
    Feb 21, 2018
    Posts:
    6
    You are awesome! That's exactly what i need from the video. However, i get error when i paste the code. Are you sure that is the only class you made changes too?

    Assets/FunkyCode/SmartSlicer2D/Components/Slicer2DAnchor.cs(26,11): error CS0123: A method or delegate `Slicer2DAnchor.OnSliceResult(Slice2D)' parameters do not match delegate `Slicer2D.Slice2DResultEvent(System.Collections.Generic.List<UnityEngine.GameObject>)' parameters


    Am i missing something?
     
  5. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @JovicaTT This is the only one class you need to change.
    But there are a lot API changes and improvements in next version (1.1.3), I totally forgot about that.
    This code should be capable with 1.1.2: https://pastebin.com/zzMWCjct
     
    Last edited: Dec 17, 2018
  6. JovicaTT

    JovicaTT

    Joined:
    Feb 21, 2018
    Posts:
    6
    Un
    Now it compiles, but unfortunately it's not behaving properly.
    It only keeps one joint and with the wrong anchor as well. I added fixed joint with anchor to the side in this video :
    https://drive.google.com/file/d/16ndboeWfu3K8_mE1IT5dK94FmTNDyl8T/view?usp=sharing
    Am i doing something wrong? Maybe you can send your demo from the video where it does work properly and i can check.

    I might actualy be implementing it wrong... ill give it another try now.
     
    Last edited: Aug 14, 2018
  7. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @JovicaTT oh for dynamic joints it would be a little bit different tweak, I'll do some tweaks ASAP.
     
  8. JovicaTT

    JovicaTT

    Joined:
    Feb 21, 2018
    Posts:
    6
    Thank you a lot. What type of joint were you using in your demo? Could you please share your demo as well?
    Thanks again for the great support, sorry for the requests, but i'm unable to fix them.
     
  9. JovicaTT

    JovicaTT

    Joined:
    Feb 21, 2018
    Posts:
    6
    I just sent you an e-mail with the pdf of the receipt. thanks.
     
  10. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @JovicaTT No problem, I want this asset to be as simple as possible to use. I'll work a little bit more on joints now.

    I've sent you new version in mail, new anchors demo is in "Demo 8 Scene".
     
  11. JovicaTT

    JovicaTT

    Joined:
    Feb 21, 2018
    Posts:
    6
    Just want to commend you here as well on the great support. The demo works just fine.
     
  12. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    Multiple joints support for 1.1.3

     
    JovicaTT likes this.
  13. Gorgor

    Gorgor

    Joined:
    Apr 28, 2012
    Posts:
    51
    Hi, when will the 1.1.3 version with multiple joints be on Asset Store? Seen this scene in your WebDemo but it is not present in the project :(
     
  14. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    1.1.3 has been just released!

    [ADDED] Demo 8 - Anchors
    [ADDED] Demo 9 - Slicer Inspector
    [ADDED] Demo 10 - Tracked Slicer
    [ADDED] "SliceIfPossible" option for Slicer2DController
    [CHANGED] Improved SetPass Calls performance in the demos
    [CHANGED] Slice Result Event now returns Slice2D object
    [CHANGED] Improved Demo 7 - Joints
    [CHANGED] Slicer2D component supports multiple joints
    [CHANGED] Slicer2DAnchors component supports multiple colliders
    [SUPPORT] Package for Unity 5
    [SUPPORT] Package for Unity 2018
     
  15. Albert_Feng

    Albert_Feng

    Joined:
    Aug 23, 2018
    Posts:
    4
    @Qzia I'm a beginner, how to use slicer in `Canvas`?
     
  16. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @Albert_Feng Could you elaborate a little bit more about what you want to accomplish with canvas?
     
  17. Albert_Feng

    Albert_Feng

    Joined:
    Aug 23, 2018
    Posts:
    4
    I want to wrote a game like your demo `Thin Slice` but I want to use the slicer in canvas, how should I do?
     
  18. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @Albert_Feng So all the game objects/colliders are in the world space like usually right?
    I don't really understand what you want to use canvas for. Canvas are usually for UI elements.
     
  19. Albert_Feng

    Albert_Feng

    Joined:
    Aug 23, 2018
    Posts:
    4
    @Qzia I usually use game objects/colliders/images in canvas as UI elements, my bad habit, :p thank you for your reply.
     
  20. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    If you could set up sample of scene you with objects to cut and send me as a package through the mail, I could check it up how to set up slicer in that environment.
     
  21. Albert_Feng

    Albert_Feng

    Joined:
    Aug 23, 2018
    Posts:
    4
    @Qzia
    Thank you very much, I will send later.
     
  22. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    v1.1.4 has been just released!

    [ADDED] Documentation is now included in the package
    [ADDED] Particles
    [ADDED] Start Slice If Possible for complex slicer
    [ADDED] Complex Cut slicing mode
    [ADDED] Slicer Controller Visuals Scaling
    [ADDED] Slicer2DAnchors Events Handling
    [ADDED] Slicing Support for animated sprites
    [ADDED] Demo Scenes now include objects counter
    [ADDED] ExplodeByPoint slicing type
    [FIXED] Sprite custom pivot point caused incorrect slicing results
    [CHANGED] Improved Mesh2D Triangulation
    [CHANGED] New CollideLineRenderer2D with increased performance
    [CHANGED] New slice objects initiation method
    [CHANGED] MathHelper class name to Math2D
    [CHANGED] Vector2f class name to Vector2D
    [CHANGED] Pair2f class name to Pair2D
    [CHANGED] Polygon class name to Polygon2D
    [CHANGED] Vector2fList name to Vector2DList
     
  23. nartay

    nartay

    Joined:
    Apr 11, 2018
    Posts:
    3
    Hello, I just bought your asset and trying to implement it into my project. I'm pretty new to Unity and C#. I would appreciate it if you can send me the demo of "Fa(s)t Slicer Demo (SmartSlicer2D)".

    Also I'm trying to access the sliced objects in a simple way but I guess I'll solve it in a few days :)

    Thanks in advance,

    Regards
     
  24. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @nartay You can find the demo in the current project.
    FunkyCode/Games - SmartSlicer2D/Game - Thin Slice

    To access sliced objects you can use Event Handling.
    You can find this information in the documentation (there are code samples too)
    If you need any assistance, feel free to ask!
     
  25. nartay

    nartay

    Joined:
    Apr 11, 2018
    Posts:
    3
    @Qzia Thanks, didn't notice the game folder :)
     
  26. zip1234

    zip1234

    Joined:
    Mar 30, 2014
    Posts:
    4
    How can i use two hinge joints on a single object ?
     
  27. SergeyKuzmich

    SergeyKuzmich

    Joined:
    Jul 11, 2018
    Posts:
    3
    Hi, thanks for the asset.

    I wanted to know what can be done with this problem?

    How to minimize its appearance? I read the old topics, but there did not find the answer. Maybe something has changed during this time. I need to made task as demo6.
     
  28. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @zip1234 Do you want to attach object so it doesn't move until it's sliced off?

    Look at anchors demo, you don't need hinge joints for that.
    What are you trying to do?

    @SergeyKuzmich What kind of game are you making?
    At the moment I'm working on a better approach to destroy terrain.

    pVre5o.png
     
    Last edited: Oct 24, 2018
  29. SergeyKuzmich

    SergeyKuzmich

    Joined:
    Jul 11, 2018
    Posts:
    3
    @SergeyKuzmich What kind of game are you making?

    The player destroys the top layer (terrain), and quickly guesses the image under the layer. The shape of the slicer can be any.
     
  30. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @SergeyKuzmich If you need "Polygon" slicer in particular.
    It is the only flawed feature (because of geometry approach) in this asset with the problem you mentioned.

    But if you need only polygon slicer in the game, I could send you a new asset I'm working through the mail.
    It has way more reliable approach on making polygon shape destruction.

     
    Last edited: Oct 24, 2018
  31. zip1234

    zip1234

    Joined:
    Mar 30, 2014
    Posts:
    4
    @Qzia i would like to use two hinge joints on both the end of the black bar and if i slice it from the middle it should get sliced and circle should fall
     

    Attached Files:

    • game.PNG
      game.PNG
      File size:
      96.3 KB
      Views:
      731
  32. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @zip1234 To set up something like this you need:
    * 2 objects with kinematic rigidbodies and hinge joint components (if uses collider, better use trigger)
    * the sliceable board with slicer component attached.

    I have set it up, but I noticed a little bug where the code swaps the wrong part which is being sliced off the hinge joints.

    To Fix the bug you need to replace one line in Slicer2D.cs, function -> SliceJointEvent

    Code (CSharp):
    1. if (poly.PointInPoly (new Vector2D (joint.anchoredJoint2D.connectedAnchor))) {
     
    Last edited: Oct 24, 2018
  33. SergeyKuzmich

    SergeyKuzmich

    Joined:
    Jul 11, 2018
    Posts:
    3
    [/QUOTE]
    Yes, it will be wonderful. With an example, please. My e-mail: info@i-fabrika.kz
     
  34. zip1234

    zip1234

    Joined:
    Mar 30, 2014
    Posts:
    4
    @Qzia Thank u very much. This solved my issue.
     
  35. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    V1.1.5 Released!!!

    [ADDED] Global Slicer2D & Anchor Events
    [ADDED] Trail slicing type
    [ADDED] Option to recalculate center of sliced object
    [ADDED] Slicer2DSound adds sounds for the sliced objects
    [ADDED] Mouse Scroll resize size of cut
    [CHANGED] Slicer2DAnchors is now built-in Slicer2D Component feature
    [CHANGED] Slicer2D Particle System performance improvements
    [FIXED] Slicer2D did not used sprite FlipX & FlipY parameters
    [FIXED] Sliceable HingeJoint anchor offset was incorrect
    [FIXED] Slicer2DController "Enable Visuals" did not worked properly
    [FIXED] Blinking collide line renderers after slicing with complex tracked slicer
    [FIXED] Slicer2DController Layer Serialization

    V1.1.6 Insights - Visual Improvements and Complex Click
    • Additional options when customizing Slicer2DController
    • New smooth looking line renderers.
    • New slicing type which adds point on each mouse click.
     
    Last edited: Nov 5, 2018
  36. zip1234

    zip1234

    Joined:
    Mar 30, 2014
    Posts:
    4
    @Qzia How can i change the size of the square that is been drawn on the screen.
     
  37. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    V1.1.7 Released

    [ADDED]
    Next & Previous Scene Buttons
    [ADDED] Complex Click slicing type
    [ADDED] Edge/Polygon Collider Generation Option
    [ADDED] Downloadable mobile demo (APK)
    [ADDED] Demo scenes supports mobile resolutions
    [CHANGED] Demo 1 Scene now includes trail slicer
    [CHANGED] Optimized visual performance
    [CHANGED] Optimized joints code
    [CHANGED] Improved Joints Demo
    [CHANGED] Improved ColliderLineRenderer visuals
    [CHANGED] Improved Slicer2DController visuals
    [CHANGED] Improved Joints Renderer visuals

    V1.1.8 Released

    [ADDED]
    Linear Trail Slicer Type
    [ADDED] 4 demo games
    [CHANGED] Improved Slicer algorithm

    V1.1.9 Released

    [ADDED]
    Linear Track Slicer Type
    [ADDED] Force parameter for linear and complex trail slicers
    [ADDED] ColliderLineRenderer "Order in Layer" parameter
    [ADDED] Slicer2DController "display collisions" parameter
    [CHANGED] Improved Slicer algorithm
     
  38. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    I've implemented Artificial Intelligence controller for the next version.
    This can be used to write tutorial levels or competitive AI/bots

    AI Code: https://pastebin.com/xUVJYrAN.

    This is an example of AI slicing objects:
     
    Last edited: Dec 17, 2018
  39. xiaok

    xiaok

    Joined:
    Jul 28, 2017
    Posts:
    5
    hi,Qzia,you plugin is very good,i'm using v1.1.0 Released.
    and how to Restore the object that has being cut.
    because i use the pool ,and i want to restore it and then Despawn,for less gc.
    thanks
     
  40. xiaok

    xiaok

    Joined:
    Jul 28, 2017
    Posts:
    5
    @Qzia thanks a lot ,can u give me some suggestion
     
  41. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @xiaok There are plenty ways of doing that. You want to restore just particular object or whole scene? Or to restore original object into sliced object position?
    There is similar feature that in slicer inspector that always shows original object's size, even though it's sliced.

    All you need is to respawn original object and remove it's sliced childs.
    Would be great if you could join discord, I'm usually giving full support there: https://discord.gg/AktrfBe
     
  42. xiaok

    xiaok

    Joined:
    Jul 28, 2017
    Posts:
    5
    i just want to restore the cut thing to origin thing.
    such as two pieces of apple by cut, after a while ,i can restore the two pieces to two apples.and
    thank you for your invite to discord,but my english is not very good,so i just can write the question on here.
     
  43. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    You need to pass original prefab to the slices. You can simply attach script with original prefab of the object. Then just instantiate it once you need it in place of sliced objects.

    Scripts are being passed to the sliced objects, so original script with prefab would be duplicated to the sliced objects.
     
  44. xiaok

    xiaok

    Joined:
    Jul 28, 2017
    Posts:
    5
    i know what you say,but is not my needs.
    thanks for your reply
     
  45. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    This is exactly what you need, I could write you a script to restore objects if you need that.
     
  46. xiaok

    xiaok

    Joined:
    Jul 28, 2017
    Posts:
    5
    thanks!.maybe i misunderstanding your meaning,if you can write some restore demo script ,that's brilliant!
     
  47. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    Smart Slicer 2D 1.2.0 Insights

    [ADDED] Input Scripting/AI (for programming AI or tutorials)
    [ADDED] Multi Touch Support
    [ADDED] Custom Physics Shape Support
    [ADDED] Tutorial Demo Scene
    [ADDED] Additional Polygon API functions
    [ADDED] Demo Scene to Restore Objects To Previous Condition
    [FIXED] Mass Recalculation (regression)
    [CHANGED] Updated Game Demos

    [INFO] Unity 2019.1 Support
     
  48. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
  49. mooumari

    mooumari

    Joined:
    May 9, 2018
    Posts:
    12
    hello, first I want to thank you for developing such a great tool like this.
    I have a question about how can I put the tag of the sliced objects to the same tag as the main object?
     
  50. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @mooumari Replied and solved in Discord channel.