Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 Karsnen_2 · Jun 21, 2012 at 02:47 PM · c#transformcloth

Position of a cloth?

Hello,

I am trying to make the camera follow a cloth.

  1. I added a empty game object and then upon it, I added the interactive cloth and cloth renderer.

  2. Then I added a mesh through the interactive cloth inspecter pane.

  3. Now I added a script on the camera to follow the cloth when it moves by transformation of the game object.

  4. The cloth by the way, moves upon gravity and falls free.

Now when I look closing, the game object stays where it is supposed to be and the cloth does nt have any object with it.

Kindly let me know if I am wrong at any place and if not, what is the best alternative way to implement it.

Thank you,

regards, Karsnen.

Comment
Add comment · Show 2
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 programmrzinc · Jun 21, 2012 at 02:49 PM 0
Share

so.. 1. is the camera not following the cloth when free falling? or 2. do you not want the cloth to free fall?

avatar image Karsnen_2 · Jun 21, 2012 at 02:53 PM 0
Share

Yes I want the camera to follow the cloth, which it is not following. and (2) currently the cloth is FALLING FREE (no problem with this).

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by J Lam · Jul 16, 2012 at 01:12 PM

Cloth simulation happens to deform the vertices instead of "move" the object, therefore the gameObject would be still from the Transform point of view, and child-parent relationship is not able to help in this case.

The way to move the camera along with the cloth is to track the vertex, Unity provide a function to retrieve the vertex position. You can refer to

 Mesh.vertices

only one vertex is enough, you could simply track the first vertex in the mesh or any ID you want in a FixUpdate or Update and adjust the camera transform according to that vertex position.

Comment
Add comment · 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
-1

Answer by programmrzinc · Jun 21, 2012 at 02:51 PM

attach the cloth to the empty game object first if you haven't done so.

@programmrzinc

Comment
Add comment · Show 5 · 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 Karsnen_2 · Jun 21, 2012 at 02:53 PM 0
Share

I think I did that. Anyway, I am going to try it again.

avatar image Karsnen_2 · Jun 21, 2012 at 02:58 PM 0
Share

Well. Now what I did was,

  1. Created an empty gameobject to (0,0,0).

  2. Added a cloth renderer which also added interactive cloth.

  3. I clicked on "$$anonymous$$esh" on the inspector and then added the mesh.

WHen I play, It had to fall upon gravity which in fact it did. But the empty gameobject just stayed at (0,0,0).

avatar image programmrzinc · Jun 21, 2012 at 03:02 PM 0
Share

ok. this is what is happening. The camera is on the gameobject, which is NOT free falling. for the camera to work, we either need to set the camera to follow the "cloth" or have the gameobject attached to the cloth. we need to try to fix this in some way

avatar image Karsnen_2 · Jun 21, 2012 at 03:09 PM 0
Share

@programmrzinc -

  1. "Camera on the gameobject" - Do you mean by child-parenting.

  2. Follow the cloth - I think I have not tried it. I also think, it would work. If so, how? Something lIke this?

    //On the Camera

    public InteractiveCloth cloth; then get it's position???

avatar image Karsnen_2 · Jun 21, 2012 at 03:11 PM 0
Share

As for as child-parenting is concerned. I think I tried that too. It did not work as the gameobject just stay at it's initial position.

$$anonymous$$oreover... I just did things like I pointed out. But still, I am not sure where I am going wrong.

It has to be either I am doing a stupid simple mistake or I am missing something.

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Conceptual Question on Creating Arrays at Runtime 1 Answer

Implement the equation as a code? 1 Answer

Instantiate Object position C#, not visible after new pos 1 Answer

C# Smoothing Out transform.Translate 4 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