• 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 piecewise · Apr 06, 2011 at 09:30 AM · meshproceduralboundsmeshrenderermeshfilter

Bounds of dynamic mesh not updating

I've got a GameComponent that's using a MeshFilter, with a dynamically created mesh, and a MeshRenderer.

As soon as the origin of the object goes off-screen, the mesh stops being rendered both in the game and scene editor views. I'm assuming this is because the bounding box of the object isn't being updated to match the mesh once it gets created.

I've called createdMesh.RecalculateBounds(), and I've also tried setting it manually, but neither work.

Do I have to set these bounds elsewhere, like on the filter itself, or the renderer, or am I going wrong somewhere else?

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
1

Answer by Jesse Anders · Apr 06, 2011 at 12:42 PM

Generally speaking, recalculating the mesh bounds should work. You might try adding some debug output; for example, you could draw the bounding box for the mesh, or simply print its min and max vectors to the console. That should at least tell you whether the AABB has been effectively reduced to a point (which is what the behavior you describe would suggest), or if the problem is elsewhere.

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 Codster · Jun 01, 2011 at 07:42 AM 0
Share

Turns out mesh.RecalculateBounds()does NOT affect renderer.bounds it just always stays at zero. So anyone have a clue what's going on lol.

Edit: Never$$anonymous$$d it does work. But only if called after the mesh is set in the mesh filter. So it's; GetComponent($$anonymous$$eshFilter).mesh = mesh; THEN; mesh.RecalculateBounds();

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Procedurally generated mesh not Rendering all triangles 1 Answer

Unity5 Procedural meshing slower than in Unity4? 1 Answer

Selecting a single polygon / face at runtime 1 Answer

sharedMesh - what is the mesh shared with? 1 Answer

"Baking" to 2d UV Map? 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