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 KarlKarl2000 · Jan 20, 2017 at 06:04 PM · meshgeometryphysics material

Same Mesh, different physics material per face

Hi,

I have a question about physics materials. How can I script (C#) it so that each face has a different physics material value.

For example a Cube.

Top face = no friction on the physics material. Bottom face = Low friction on the physics material. Sides x 4 face = Medium friction on the physics material.

Thanks! Sharing is caring!

https://twitter.com/IndieNendoroid

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 HenryStrattonFW · Jan 20, 2017 at 11:23 PM

The only way I can think of to get one cube mesh to have multiple materials would be do have 4 separate collider components, each set up to cover one face of the cube, that way each collider could be set to a different physics material. So one cube mesh, then slim box colliders configured to cover one face each.

Might be another way but I'm fairly sure this would be a relatively simple way to achieve this.

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 KarlKarl2000 · Jan 21, 2017 at 03:31 AM 0
Share

@ HenryStrattonFW Yea that's what I'm doing now. I have a bunch of boxcolliders "overlapping" the different sides, but I'm not sure if that's the "cleanest" way to do it? Was wondering if there was a code way to handle it ins$$anonymous$$d.

Thanks for the suggestion.

Sharing is caring!

https://twitter.com/IndieNendoroid

avatar image HenryStrattonFW KarlKarl2000 · Jan 21, 2017 at 03:57 PM 0
Share

The only way I can think of to do it in code would in my $$anonymous$$d be just as messy to be honest but for the sake of completeness here goes. You could various position checks and or raycasts to work out which surface of the cube a target object can be colliding with (assu$$anonymous$$g only a single convex shape colliding with the cube) you could then have one cube collider and just swap the Physics$$anonymous$$aterial based on which face is able to be hit (if you consider a sphere and a cube, there is only ever one face that it could interact with at a time).

However this sort of approach would only allow one object to be properly utilised alongside the cube as the second you have two objects you could have two different faces "active" at once which is then unsupportable with only one physics material.

avatar image KarlKarl2000 HenryStrattonFW · Feb 17, 2017 at 08:37 AM 0
Share

@HenryStrattonFW

Sorry I missed your reply. You're right, it could get complicated really fast depending on the collider mesh's complexity.

Guess I have to stick with various box colliders on different sides of the mesh then.

Thanks for helping me bounce ideas.

Sharing is caring!

https://twitter.com/IndieNendoroid

Show more comments

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

93 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

Related Questions

Calculating mesh area 0 Answers

moving vertices dynamicly relative to other Object 1 Answer

Is there any good CSG lib for runtime mesh modification ? 0 Answers

What is the best way to deep profile memory usage ? 1 Answer

Putting material on one thing puts it on all the things... 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