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 /
  • Help Room /
avatar image
0
Question by MoonBoop · Jul 12, 2019 at 12:16 PM · meshprocedural mesh

Procedural mesh AABB error on OSX

Hi there, I've been having a lot of trouble solving an error I've been getting during runtime. When the function I've made called BuildBezierPlane() is called once, the editor will spit out the errors:

  • Invalid AABB aabb

  • Invalid AABB result

  • Invalid AABB a

  • Assertion failed on expression: 'IsFinite(outDistanceForSort)'

if it is called more than once, it will not return any errors, but it will skip the first mesh generated by this function. If a different function that also builds a mesh in the same way is called at the same time instead of this one, it will build fine.

This snippet of code will generate a quad perfectly if called instead of BuildBezierPlane: protected void BuildQuad(MeshBuilder meshBuilder, Vector3 offset, float width, float length) { meshBuilder.Vertices.Add(new Vector3(0.0f, 0.0f, 0.0f) + offset); meshBuilder.UVs.Add(new Vector2(0.0f, 0.0f)); meshBuilder.Normals.Add(Vector3.up);

     meshBuilder.Vertices.Add(new Vector3(0.0f, 0.0f, length) + offset);
     meshBuilder.UVs.Add(new Vector2(0.0f, 1.0f));
     meshBuilder.Normals.Add(Vector3.up);

     meshBuilder.Vertices.Add(new Vector3(width, 0.0f, length) + offset);
     meshBuilder.UVs.Add(new Vector2(1.0f, 1.0f));
     meshBuilder.Normals.Add(Vector3.up);

     meshBuilder.Vertices.Add(new Vector3(width, 0.0f, 0.0f) + offset);
     meshBuilder.UVs.Add(new Vector2(1.0f, 0.0f));
     meshBuilder.Normals.Add(Vector3.up);
     int baseIndex = meshBuilder.Vertices.Count - 4;

     meshBuilder.AddTriangle(baseIndex, baseIndex + 1, baseIndex + 2);
     meshBuilder.AddTriangle(baseIndex, baseIndex + 2, baseIndex + 3);
 }

This snippet here will return errors if called only once:

 public void BuildBezierPlane(MeshBuilder meshBuilder, Curve top, Curve bottom, Curve right, Curve left)
 {
     int baseCount = meshBuilder.Vertices.Count;
     int width = bottom.Positions.Count;
     int height = left.Positions.Count;

     if (height > 1 && width > 1)
     {
         for (int y = 0; y < height; y++)
         {
             for (int x = 0; x < width; x++)
             {
                 float t = y / (height - 1.0f);
                 Vector3 p0 = bottom.Positions[x];
                 Vector3 p1 = Vector3.Lerp(left.Positions[width / 2], right.Positions[width / 2], y / (height - 1.0f));
                 Vector3 p2 = top.Positions[x];

                 Vector3 position = (1.0f - t) * (1.0f - t) * p0 + 2.0f * (1.0f - t) * t * p1 + t * t * p2;
                 position = new Vector3(x, y, 1);
                 meshBuilder.Vertices.Add(position);
                 Debug.Log("Positions: " + p0 + p1 + p2);
                 meshBuilder.UVs.Add(new Vector2(x / (width - 1.0f), y / (height - 1.0f)));
             }
         }

         for (int ti = 0, vi = 0, y = 0; y < height; y++, vi++)
         {
             for (int x = 0; x < width; x++, ti += 6, vi++)
             {
                 meshBuilder.AddTriangle(vi, vi + width + 1, vi + 1);
                 meshBuilder.AddTriangle(vi + 1, vi + width + 1, vi + width + 2);

             }
         }
     }
     else
     {
         return;
     }
 }


I've employed many fixes already suggested by the unity community on reddit and game development circles, but none of them have worked. Could this be a mac osx Mojave specific problem?

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

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

191 People are following this question.

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

Related Questions

[Help Request] 2D Wave Generation & Animation 2 Answers

Problem with Procedural Mesh Generation 1 Answer

Mesh Creation at Runtime - Strange black artefacts 0 Answers

Different textures on different meshes but same material 0 Answers

Procedurally generated mesh having some faces that don't receive light 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