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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Polak149 · Mar 08, 2015 at 12:11 PM · physicstriggermeshcollider

Unity 5.0 and alternative for triggering complex meshes.

Now, when physX 3.3 is up, non-convex mesh cannot be a trigger. It gives me a headache, because half of my game was based on large mesh surface, that was a trigger. Convex mesh cannot have more triangles than 255. I tried to split my mesh to smaller parts (that already have only 255 triangles), but even then, pressing "convex" tick is just breaking my splitted mesh. I have a almost flat surface and i don't think, that

alt text

Is there now possibility to create large, static mesh, that will act like trigger? I need to know if any scene object touch my surface (like OnTriggerEnter) and objects have to be able to pass through surface (like after pressed isTrigger in collider component!). I cannot use raycasts, because objects, that can touch surface can be hundreds. Building collider from primitives also cannot be used, because my surface is generated procedurally. It can change shapes every game.

stack.jpg (285.0 kB)
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

2 Replies

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

Answer by Polak149 · Mar 18, 2015 at 05:50 AM

Recently I have found different solution, that is best for flat surface. The idea is to close our complex mesh in primitive collider and try two Collider.Raycast on every object that had trigged it. We can shot first Collider.Raycast from our incoming object collider to our complex mesh. It gives as point from we can shot another raycast and gives as position where object would hit surface (at moment!). When we shot second ray to our incoming object, distance of that second ray is value between object and our trigger (mesh collider). If second Raycast return false (what basically means that distance is <=0) it had to be a touch event.

NOTE: Better our primitive fits the complex mesh, better performance we get, since less rays have to be cast.

Comment
Add comment · 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
0

Answer by WillNode · Mar 09, 2015 at 12:14 PM

I found a workaround about this problem :

 void OnCollisionEnter (Collision other)
 {
     GetComponent<MeshCollider>().enabled = false;    
     //Do Trigger Enter Stuff    
 }

it's not always the best, since the objects will loses their velocities at first hit, but based on your usage, it's maybe useful.

Also note you need to Re-Enable the Mesh Collider back when the player is spawned back.

Comment
Add comment · Show 3 · 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 Polak149 · Mar 17, 2015 at 11:18 PM 0
Share

I can't do it. $$anonymous$$y surface should handle hundrets of objects. I can't endable and disable collider whole time. But i have come up with solution!

avatar image WillNode · Mar 18, 2015 at 12:25 AM 0
Share

you have your own solution? can you tell me please? since i have a same problem and so far this is my best solution.

avatar image Polak149 · Mar 18, 2015 at 07:00 AM 0
Share

I have posted my answer and taged it as "good solutuin" :)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Moving Trigger not detecting stationary MeshCollider 0 Answers

How to refresh rigidbody colliders modified at runtime 0 Answers

Is there a way to determine if an object is within a trigger, from objects perspective? 2 Answers

Version 3.2 gives no OnTriggerExit when collider is parented 12 Answers

Collider IsTrigger won't work correctly with close second Collider 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