Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 alph1 · Apr 06, 2017 at 07:26 PM · 2dcollidercollider2d2d-physicscollider.oncollisionenter

PolygonCollider2D edit problem

I have created a script that build a mesh which represents the fluid based on collider objects in the scene.To detect if this fluid touches anything i have to convert these mesh vertices to Polygoncollider so this way it would be able to detect 2d components when it collides but i have come across with an interesting problem.The problem is when a pull the vertices data and import it in the polygoncollider by using SetPath my fluid mesh object disappears at sometimes(in some frames).I check if it was a problem that environment based but its not here the things that i know about the problem

but first to clear things the objects which i have in my scene

  1. A game object that contains the mesh data

  2. A game object that contains polygonCollider component (apart from the mesh object)

  3. A gama object that contains my script which i use this script to create mesh and polygoncollider object seperately

Lets come to the things i know about the problem

  1. Problem disappears when i delete the line which holds to pass vertices to polygonCollider

  2. If i run the code my mesh appears and disappears like randomly

  3. I freezed to scene and checked the polygoncollider and when i checked the points array it was the same positions 1-360 all of them was the same.

  4. The identical positions was irrevelant from the actual positions, the positions when objects appears without a problem

And here my code part that runs the line that i pass mesh vertices to polygoncollider

         Triangulator _tr = new Triangulator (_collection); 
         Mesh _mesh = new Mesh();  
         _mesh.name = "MeshVolume"; 
         _mesh.vertices = Roveldo.convertDimension (_collection); 
         _mesh.triangles = _tr.Triangulate();  
         //_mesh.uv = _collection;
         _mesh.RecalculateBounds();
         _mesh.RecalculateNormals ();
         _obj.GetComponent<MeshFilter> ().mesh = _mesh; 
         border.GetComponent<PolygonCollider2D>().SetPath(0,_collection); // THE PROBLEM
 
     

If you dont have a clue to solve this would you help me with these things below ?

  • If there is a way to detect meshcollider with 2d collider components.

  • If there is a better way to achive this other than colliders.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by alph1 · Apr 20, 2017 at 04:56 PM

Well i solved the problem its silly that i forgot adding a layermask so when build polygoncollider the frame after his build rays collides with the polygonCollider i created.So there is no problem lies here.

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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Collider lets object through 0 Answers

Scaling colliders up and down over time 1 Answer

Moving colliders that are part of a composite collider 1 Answer

OnCollisionEnter2D being called upon exiting collider? 1 Answer

2D colliders not colliding 2 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