Search Unity

Unity5: alternative to Cloths?

Discussion in 'Physics' started by hashashin, Apr 14, 2015.

  1. hashashin

    hashashin

    Joined:
    Mar 31, 2014
    Posts:
    22
    Hello

    As I understand, clothes were rewritten, are faster, and now only usable to dress your characters like if you were playing with Barbies. A lot of other uses, like as a parachute or a flag, are no longer supported.

    What is the current approach to create a flag-like object? Manually program it? We no longer have the possibility to add colliders to some specific points of the cloth, or adding a join or anything.

    Is there any straightforward alternative?
    (yeah, I know there are some flags being sold in Asset Store, but not sure if they will work with Unity5, now!!)

    Thanks for any hint
    Alberto
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    Is the flag going to collide something, or respond to wind or something else?
    Or could just have a waving vertex effect on a plane?
     
  3. bobby_1984

    bobby_1984

    Joined:
    Mar 15, 2015
    Posts:
    1
    If you want to make a flag, create plane & add cloth component > add the plane mesh to the skinned mesh renderer > edit constraints and constrain on one edge > use external acceleration for wind.
     
    hashashin likes this.
  4. FreakyT

    FreakyT

    Joined:
    Nov 21, 2013
    Posts:
    4
    That almost works, but since Unity doesn't render backfaces, the flag appears invisible from the opposite side. Is there any way to fix this?
     
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    Isn't a double-sided shader what's normally used?
     
  6. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    You need to turn 'Backface Culling' off. See also this Manual page: ShaderLab: Culling & Depth Testing

    Basically, you write 'Cull off' in the Pass of the SubShader. Download the Built-in shaders from the Unity Download page (it's under 'Additional Downloads'), copy the Standard.shader out of the .zip file into your project and edit it with MonoDevelop.
     
    Last edited: Apr 15, 2015
    FreakyT and hopeful like this.
  7. hashashin

    hashashin

    Joined:
    Mar 31, 2014
    Posts:
    22
    Hey

    Thank you all for the answers. I'll try to follow your suggestions. On the "one-side only" problem, I usually did that with two panes, one in each direction. But if changing the shader also works, I will dig that.

    But as far as I could understand, I will need to turn of gravity, right? As the constrain does not force the object not to move.

    Thanks
    Alberto
     
  8. FreakyT

    FreakyT

    Joined:
    Nov 21, 2013
    Posts:
    4
    Thanks! I did that, and it nearly works, but I noticed that the shadows/lighting don't appear correctly when viewing the object from the reverse side. Examples:

    From the front of the plane, the sphere casts a shadow:


    After rotating the plane 180 degrees around the Y axis (no other changes to the scene), there's no more shadow, and the lighting looks different:


    I just added "Cull Off" into each SubShader Pass (I attached the edited version of the shader for reference). Is there something else I should be doing?

    Thanks!
     

    Attached Files:

  9. hashashin

    hashashin

    Joined:
    Mar 31, 2014
    Posts:
    22
    Wonderful. Thanks!
     
  10. hashashin

    hashashin

    Joined:
    Mar 31, 2014
    Posts:
    22
    Just to correct me, gravity in the cloth component is not the "default" gravity, so, it is ignored by constrained nodes.