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 MountDoomTeam · Dec 28, 2012 at 04:35 PM · errormeshmemoryverticesclear

mesh.vertices.position stuck in memory error?

I am coding a level design program, and did a rampyfier to make ramps and stairs from corridors.

the code is written ok and works for all the other objects except the first and last tiles of the roof, the code is telling those objects to line up same as the others but they aren't, in fact one is still flat and the other is being slanted twice. it's as if the first and last obj in the array are being exchanged outside of the code instructions?

i think i may have imported the roof tile wrong? the primitives all are ok but imported mesh = that error. do i have to clear the memory before writing vertices to the next object?

alt text

         for (var mymeshfilter in mymeshfilters){
         
                                      
                     var vtxArray : Vector3[];
                     //Debug.Log ("name  "+mymeshfilter.gameObject.transform.name+"  objspos  "+mymeshfilter.gameObject.transform.position );
                     var mesh : Mesh = mymeshfilter.gameObject.GetComponent(MeshFilter).mesh;
                     var scale = basescale;
                     if (vtxArray == null)
                         vtxArray = mesh.vertices;
                             
                     var vertices = new Vector3[vtxArray.Length];
                     for (var i=0;i<vertices.Length;i++)
                     {
                     
                         //var vertex = vtxArray[i];
                         vtxArray[i] =  mymeshfilter.gameObject.transform.TransformPoint(vtxArray[i]);
                         var vertex = vtxArray[i];
 
                         if (  df.z <  0 ){ //depending on travel vector of digger, set joint as maximum or minimum of selected tunnel
                             if (vtxArray[i].z<=floatmax.z-9){vertex.y += (vtxArray[i].z-floatmin.z+basescale/2)* df.z*extentz*multiplier;}
                             if (vtxArray[i].z>floatmax.z-9){vertex.y += -3*multiplier;}//convert tunnel to points and mult by slope 
                         }        
                         
                         vertices[i] = mymeshfilter.gameObject.transform.InverseTransformPoint(vertex);
                         //Debug.Log ("vtx  "+vtxArray[i]);
                         
     }
         mesh.vertices = vertices;
         mesh.RecalculateNormals();
         mesh.RecalculateBounds();
         DestroyImmediate(mymeshfilter.gameObject.collider);
         mymeshfilter.gameObject.AddComponent("MeshCollider");
             }    
         }

alt text

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 MountDoomTeam · Feb 02, 2013 at 02:26 PM 0
Share

bump, the only difference between the mesh that makes array errors and the others which tile fine, is that it is an object from sketchup, and it has more vertices than the others. Perhaps I have to try and reimport it from blender ins$$anonymous$$d. maybe it is already but I will do it again.

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

8 People are following this question.

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

Related Questions

Modify mesh on load 1 Answer

Changing Mesh Vertex Colors in editor 0 Answers

Creating a mesh out of a linerenderer - how do you convert revolved vertices set to triangles and uv's 1 Answer

Mirror vertices procedurally 2 Answers

Flattening a mesh by deforming it 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