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 bpears · Jun 03, 2013 at 07:55 PM · javascriptmeshnormalsskinned-mesh

Average vert normals between 2 child meshes?

How can this be done in Unity? I would do it in my modeling software, but FBX doesnt support it on export for skinned meshes. And importing the modeling software file itself still gets converted to FBX in the background of unity, so that wouldn't work. SO, how can I do this in code(unityscript)? Should be coded into a Start function right?

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 bpears · Jun 03, 2013 at 10:56 PM 0
Share

I am talking about having explicit normals on a object that is broken into several mesh pieces, so there are no seams between them.

1 Reply

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

Answer by Julien-Lynge · Jun 03, 2013 at 10:31 PM

Vector3 averagedNormal = (normal1 + normal2) / 2;

Comment
Add comment · Show 4 · 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 bpears · Jun 03, 2013 at 11:03 PM 0
Share

Thank you for the reply!!! So I would probably have to attach script to parent of the mesh peices, use GetObject to get each mesh, but then how do I assign mesh normals to normal1 and normal2 variables?

I mean, how do you assign a meshes normals to a variable?

avatar image bpears · Jun 03, 2013 at 11:17 PM 0
Share

This?

var normals : Vector3[] = mesh.normals;

But then that would use whatever mesh the script is attached to, so how could I use that in combination with GetObject? To pull in normals from child meshes?

avatar image Julien-Lynge · Jun 06, 2013 at 03:55 PM 1
Share

By GetObject I assume you mean GameObject.Find()?

You would do something like this to get down to the normals:

 $$anonymous$$esh mesh = GameObject.Find(Whatever).GetComponent<$$anonymous$$eshFilter>().mesh;
 Vector3[] normals = mesh.normals;

Note that this is C# - you'll have to go through the examples in the script reference to get the equivalent JS calls, as I'm not a JS guy.

avatar image bpears · Jun 07, 2013 at 06:42 PM 0
Share

Thank you!

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

15 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

Related Questions

Dynamically instantiated skinned mesh not playing animations 4 Answers

Problem drawing a mesh with Graphics.DrawMeshNow 1 Answer

Algorithm for automatic mesh creation 1 Answer

Any script to 'fix' normals/winding order? 3 Answers

Model faces arent showing up even though I reversed my normals. Anyone know what's wrong? 3 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