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 EvenArmless · Apr 24, 2015 at 06:03 PM · meshskinnedmeshrenderercombinecombinemeshescombined skinned mesh renderer

skinned mesh renderer, combine meshes can't see the result, what am I doing wrong/ missing?

I put all the skinned mesh renderers I want to combine in a variable called combine. smrenderer is the skinned mesh renderer i want the combined mesh in. "i" loops through the smrenderers in combine. "j" and "k" are used to copy the materials. I have tried with and without the localtoworld line.

The bones are set to that of the main mesh object and the root transform is set to the root of these bones. All of this is working as it should according to the data I can get with watch in monodevelop, except for recalculatebounds, which gives me a bounding box around something in 2D that I can't see. I get a new skinned mesh renderer with 35 materials(don't ask why I have so many it's just a test) and seemingly the right amount of vertices, correct number of bones with correct names. the meshes were working correctly with animation, together, before they were merged. when they are merged they all disappear and I can't find them. nothing appears to be wrong and since I can't see the meshes at all I don't know what the problem is.

  CombineInstance[] combine = new CombineInstance[smrenderersToCombine.Length];    
             int i = 0;
             while (i < smrenderersToCombine.Length) {
                 combine[i].mesh = smrenderersToCombine[i].sharedMesh;
                 //combine[i].transform = smrenderersToCombine[i].transform.localToWorldMatrix;
                     Material[] newmats = new Material[smrenderersToCombine[i].materials.Length+smrenderer.materials.Length];
                 int j=0;
                 for(;j < smrenderer.materials.Length;j++){
                     newmats[j] = smrenderer.materials[i]; 
                 }
                 for(int k = 0 ; k < smrenderersToCombine[i].materials.Length ; k++){
                     newmats[(j+k)] = smrenderersToCombine[i].materials[k];
                 }
                 smrenderer.materials = newmats;
     
                 smrenderersToCombine[i].gameObject.SetActive(false);
     
                 i++;
             }
     
             //set own data, just once
             smrenderer.rootBone = referenceBrotherPosition.transform;
             smrenderer.bones = smrendererRef.bones;
             //Set own mesh, make function of this
             smrenderer.sharedMesh = new Mesh();
             smrenderer.sharedMesh.CombineMeshes(combine);
             smrenderer.sharedMesh.name = "ABAGGARD";
             smrenderer.sharedMesh.RecalculateBounds();
             smrenderer.sharedMesh.RecalculateNormals ();
             VertNumber = smrenderer.sharedMesh.vertexCount;
 
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 EvenArmless · Apr 24, 2015 at 11:28 PM 0
Share

It seems the actual vertex points positions are the only thing that doesn't carry over to the product of the function. all the 6000 vertices of the new mesh have the xyz- values (0,0,0). these values were correct in the objects in the list I sent to the combine function.

0 Replies

· Add your reply
  • Sort: 

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

2 People are following this question.

avatar image avatar image

Related Questions

Combining meshes in game without loosing boneWeights 0 Answers

CombineMeshes() Not Working Properly? 0 Answers

Assertion failed on expression: '(int)lastVertex < GetVertexCount()' 1 Answer

Drawcalls vs MeshCombiners 1 Answer

CombineMeshes not working on one machine but is on another 1 Answer


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