• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Tocaro · Jul 28, 2012 at 02:17 AM · clothinteractive

Interactive cloth disappears

Whenever the cloth goes out of camera, when the parent object that it's attached to move back in frame the cloth sometimes is not there. Even weirder, if I pause the game and select the parent object the cloth reappears.

I tried multiple t$$anonymous$$ngs already: Turned off 'don't renderer when offscreen' Changed attachment tear factor from 0.2 to 999 to 0. Took of two way interaction turned off all acceleration external or random turned off gravity.

Not$$anonymous$$ng fixed it. The parent object is a rigidbody that is moved by applying a constant force. Presumably the problem is in the renderering not the transform, but I'm not really sure. Any ideas?

EDIT:

Alright I tried one more t$$anonymous$$ng, setting the parent object to kinematic (So they wouldn't move) then having my character move so that they were put out of screen, then when I moved so they were back in view, the problem didn't occur. However, I do need them to move, looking at some other questions I heard someone talking about having the object only move with FixedUpdate (or LateUpdate, anyway, the one for physics only) so I'll try that next, as it seems like now it's more of a movement rather then a rendering problem.

LAST EDIT:

Okay yep that fixed it. Just edited t$$anonymous$$s so that anyone who has t$$anonymous$$s problem knows the solution: If your Interactive cloth that's parent to an object that moves via a rigidbody is disappearing when the object goes offscreen (Meaning it does not return when the object returns to the screen), the problem is that the rigidbody is having it's forces affected in an Update() that is not FixedUpdate(). Anyway, anyt$$anonymous$$ng done to physics should be in FixedUpdate regardless, so you know, do that.

OKAY MAYBE NOT:

Alright now I'm a bit confused I was only testing it on one guy and switc$$anonymous$$ng it to FixedUpdate seemed to fixed the problem, but once I unfroze the other two guys and it started doing it again (Maybe it already was before that but just not as severely?). Yep just tested it again with just one guy and FixedUpdate, it's still doing it. Absolutely no clue now.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Diekeke · May 30, 2013 at 11:34 PM 0
Share

Same here! Need help :(

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Diekeke · May 31, 2013 at 12:27 AM

Hey! I figured it out! Just add another camera with Projection -> Orthograp$$anonymous$$c and Clear Flags -> Don't Clear, then, on Culling Mask, just put the layer your object is, so your cloth is always visible by that camera. It worked for me, hope t$$anonymous$$s helps you! :)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SirBedlam · Aug 28, 2013 at 04:07 PM 0
Share

Yes! This fixed it for me, too. Although rather than creating an orthographic camera, I created a normal perspective camera that's parented to the cloth object, and positioned so it's always looking at the cloth from a distance that ensures it's always 100% visible. I also have just "Solid Color" set for "Clear Flags", though I'm not sure if that matters at all. Either way, this definitely fixed it for me. Thanks!

avatar image
1
Wiki

Answer by cbm010888 · Jun 09, 2013 at 03:34 AM

Outstanding! Your solution solved a long-standing problem in my game.

I had noticed that selecting the InteractiveCloth object with Scene tab displayed would "guarantee" the InteractiveCloth object would not be culled. I did not t$$anonymous$$nk to create a "virtual Scene camera" in the Project Hierarchy, though. Good catch.

T$$anonymous$$s problem may be related to reported problems with dynamic mesh not rendering unless RecalculateBounds() is called after setting the mesh to the renderer. I tried calling RecalculateBounds() every Update() based on the InteractiveCloth.mesh but I suspect t$$anonymous$$s fails because the ClothRenderer has a copy of t$$anonymous$$s mesh and changes to InteractiveCloth.mesh do not propagate to the ClothRenderer -- w$$anonymous$$ch does not expose its mesh property.

Hence the need for your work-around. Many thanks.

A further note. In order to keep the orthgrap$$anonymous$$c camera view 'invisible' on the game screen, you can increase the size to 1000 w$$anonymous$$ch appears as a pixel or subpixel during gameplay. So create a camera as you indicated, after setting Projection->Orthograp$$anonymous$$c, a Size parameter appears in the inspector. Change the size from 100->1000.

It seems to me (not verified experimentally) that t$$anonymous$$s should be more efficient than the alternative -- w$$anonymous$$ch also works -- of rendering the Orthograp$$anonymous$$c camera to texture using Camera.TargetTexture -> select a render texture.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Pawl · Jul 25, 2014 at 08:28 PM 0
Share

Holy shit, I was experiencing similar issues as described in this thread, and sure enough, adding a dummy camera to always look at my cloth objects appears to have instantly fixed the problem.

So it seems this culling problem would still exist as of Unity 4.5.1f3 Pro.

This is a particularly nasty bug because someone might spent time debugging the problem around InteractiveCloth, when in fact the true cause is a culling problem.

avatar image ODINKONG · Feb 20, 2015 at 06:33 AM 0
Share

This doesn't fix my problem. It also causes about a 10 frame drop in performance. I have looked everywhere for a solution to this and I have found nothing works. The cloth disappears after its moving a certain speed. Does anyone know of any other ways of solving this. My cloth is parented to the player in my game. The player also needs to be able to move very fast...

avatar image ODINKONG · Feb 20, 2015 at 06:39 AM 0
Share

Ok so I have verified that my cloth is not going outside the culling. Its actually getting physically left behind the parent. Sometimes If I turn around I can see it sitting back where I just was. Then eventually it snaps back to the right position.

avatar image
0

Answer by Hazneliel · Jul 23, 2016 at 06:37 AM

You need to enable "Update when offscreen" on the Skinned mMesh Renderer

T$$anonymous$$s will render the cloth even outside the culling

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sniperisa · Oct 05, 2016 at 03:54 PM 0
Share

Yes then it reapears, but then the cloth gets somehow reinitialized when it reenters the rendered area which sometimes has really strange effects. For example: I have Sailboats with sails and when the sails reenters it sometimes wobbles in high speed around the mast and slowly gets in to the form it supposed to take. Often it is scrambled around the mast.

I get the same effect, when i disable and enable the Skinned Mesh Renderer, so i think that is what "Update when offscreen" is doing. So it only fakes it. I get better results when i enable and disable the cloth itselt too. I do that when raising and lowering the sails.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Binding Cloth to hang from ceiling 2 Answers

Set the position of a cloth 0 Answers

Interactive Cloth Glitch? 2 Answers

How to use Clothing 0 Answers

How to prevent the cloth sim from breaking after changing the transform.parent of an ancestor 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges