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
1
Question by 3Duaun · Jan 23, 2011 at 05:27 PM · meshruntimeverticescombinemerge

merge vertices at runtime?

is it possible to merge vertices at runtime? I'm aware of stitchscape, however, I'm not trying to merge terrain segments.

I have a preset number of tiles for an environment, that after the script I have chooses which ones to place, I would then like the ability to merge the verts at each face/side of each tile to get one seamless mesh WITH MERGED VERTICES(not the combineChildren method that just combines meshes).

Is anyone aware of how, or if this is possible in unity AT RUNTIME?

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 VivienS · Jan 02, 2012 at 10:40 AM 0
Share

I'm looking for something similar at the moment. Ideally a script that already exists. Does anyone know if there is one?

1 Reply

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

Answer by Brian-Kehrer · Jan 23, 2011 at 05:35 PM

Sure, but you'll need to do it yourself.

Take a look at the Mesh class.

It will work something like this

  1. Get all meshes you want to combine
  2. Extract relevant mesh data (verts, normals, UVs whatever)
  3. Combine mesh data into new arrays
  4. Loop through combined verts, and check to see if any overlap
  5. Flag overlapping verts and remove them from all arrays, in the case of triangles, you'll have to be careful.

This certainly isn't easy, and depending on your requirements, there are quite a few different ways of doing this.

In a case where I needed to merge verts before, I trimmed all the float values of the vertices, and added them to a dictionary, keyed on vertex position, and set to return the index. That way, when overlapping verts were added, the old verts were overwritten. You could then look up into the dictionary based on position to retrieve the index. Again, there is a fair amount of complexity there which I'm skimming over, but hopefully you get the idea.

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 3Duaun · Jan 23, 2011 at 05:52 PM 0
Share

just the answer I was looking for! You wouldn't happen to know of any example/reference scripts anywhere online that could help me understand the details of your post would you? If so I'd be most appreciative. Thanks again

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

1 Person is following this question.

avatar image

Related Questions

What's the Script for Combining Prefabs 2 Answers

Combine meshes, Weld planes together 0 Answers

Merge game objects during game? 0 Answers

Change color of mesh triangle based on Y position in world space 1 Answer

Run Time Plastic Shrink/Wrap , Mesh Manipulation 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