Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

fake slicer

Discussion in 'Made With Unity' started by mgear, Dec 8, 2010.

  1. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
    hi,

    Just a test project.. : )

    FakeSlicer
    - Slicing a box (but not really)
    - It works by adjusting box size/vertices and cloning a prefab box as a new slice object
    - Sliceplane is "fake", just Y value is used for getting a location
    - Adjusts rigidbody weights based on object size/density (so each slice has "correct" weight)
    - Missing: texture adjustment (now it shrinks..)

    webplayer:
    http://unitycoder.com/blog/2011/08/07/meshslicer1/
    w/s = move plane up/down
    a = slice
    mouse = drag objects
    *sometimes objects fall through the ground..refresh demo to try again

    download:
    - Package ( script with comments)
     

    Attached Files:

    Last edited: Aug 8, 2011
  2. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Very cool. Thanks for sharing this! :)
     
  3. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    2,960
    Fake? Not sure there are other ways, but no matter how you slice it it's the end result that matters :)
     
  4. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,248
  5. sunset

    sunset

    Joined:
    Nov 7, 2010
    Posts:
    61
    Very nice idea,
    Try to make the same with cones, this should work ; )

    Maybe some will get a cool idea for a slicing game.

    One thing i noticed is that the texture gets contrakted.
    Can you Change the Tileing of the texure to fix that?
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
    Hi,

    Texture can be fixed with uv map atleast..
    (planar uvmap code from docs "locked" streching, havent tried others..)

    Another simple test scene:
    - with cylinder, sideways.

    webplayer:
    http://unitycoder.com/blog/2011/08/09/fake-mesh-slicer-v2-0/
    a/d = move cylinder
    space = slice
    mouse = drag objects

    download:
    - Package ( script with comments)
     

    Attached Files:

    Last edited: Aug 8, 2011
  7. Pelajesh

    Pelajesh

    Joined:
    Dec 7, 2009
    Posts:
    363
    one bug tho... When you cut the cylinder and the cylinder is not under the slicer then it will create a cylinder that has a height of 0 :p
     
  8. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
    thats the 'fake slice' then : )
    (min-height checking missing/failed)
     
  9. Jay_Adams

    Jay_Adams

    Joined:
    Nov 8, 2010
    Posts:
    152
    My new game 'Slice the Salomi' takes place in a butcher shop.
     
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
    Hi,

    Testing different technique
    - Capsule (but bit too low poly capsulecollider not so good for this..)
    - 'Infinity plane' for cutting ( http://unity3d.com/support/documentation/ScriptReference/Plane.html )
    - Using "Plane.GetSide" to check which side the vertex is
    - if above cutplane, move it down with distance from "Plane.GetDistanceToPoint"
    - Clone the slice from original object

    Webplayer:
    http://unitycoder.com/blog/2011/08/09/fake-mesh-slicer-v3-0/
    wasd = move cutting plane
    qe = rotate cutting plane (dont rotate it upside down..)
    space = slice
    mouse = drag objects (try dragging the original object and cut it while hanging in air)
    (cannot cut the slices, just the original object, although should be possible to do that, or to cut multiple objects)


    Download:
    - Package ( script with comments)

    *edit typo
     

    Attached Files:

    Last edited: Aug 8, 2011
  11. Gaidzin

    Gaidzin

    Joined:
    Nov 14, 2012
    Posts:
    11
    What about Skinned Mesh?
     
  12. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
  13. Gaidzin

    Gaidzin

    Joined:
    Nov 14, 2012
    Posts:
    11
    Last edited: Jul 7, 2015
  14. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
    yeah, thats the "fake" part of the slicer :) it just duplicates the mesh and pushes the "cut" vertices to the cut plane.

    Maybe you could improve the effect by placing all cut vertices in the center, so at least they wouldnt stick out..

    But there are real mesh slicers in asset store, TurboSlicer and maybe some more,
    not sure if theres some free ones..
     
  15. Gaidzin

    Gaidzin

    Joined:
    Nov 14, 2012
    Posts:
    11
    I'll try to improve. We will have a free slicer. :cool:
     
    SAOTA likes this.
  16. mohoyoyo

    mohoyoyo

    Joined:
    Apr 14, 2015
    Posts:
    9
    Any improvement on this topic? I'm really interested on it.
    Regards
     
  17. Kiwi2112

    Kiwi2112

    Joined:
    Jun 30, 2017
    Posts:
    7
    I have this and the Invector Melee Template, i'm trying to use this to be able to cut enemys apart. so far it works but i can only cut either the mesh or bone, any ideas how I can fix this? Iv'e gotten so close lol
     
  18. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    6,139
    no updates to those..
    i think asset store had several slicers, for characters also.
     
unityunity