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
2
Question by Jesdisciple · Feb 28, 2013 at 10:54 PM · collisiontriggermodelmeshcolliderunity 4

Why does my trigger-collider receive Enter but not Stay or Exit?

Why would a mesh collider call OnTriggerEnter but not OnTriggerStay or OnTriggerExit? My coworkers and I are all baffled; all of our guesses have been disproved.

The design for my project involves a turret with an area of effect described by a symmetrical triangle (mesh from our modelers), with the point at the turret and scaled along the turret's trajectory to also touch the cursor.

Follow that cursor!

When the user moves the cursor (mouse or touch), the area of effect rotates to look at it and scales to span the gap between the turret and the cursor. While all of this is happening, I need to know when collisions with other stationary things start, continue, and stop.

For completeness, I should mention that the same modeler made both the triangle and another mesh that I position by the cursor. The other mesh reports collisions just fine, but the triangle only reports OnTriggerEnter.

Looks right to me...

If I put a BoxCollider on the triangle, it works fine.

The other model is positioned near the cursor by placing it at the same position as an empty GameObject childed to the triangle. Since it receives collisions fine and collisions are supposed to require motion, I tried making another triangle and positioning the original triangle according to an empty GameObject on my new triangle (whew!). It didn't help. (I would include another picture, but I'm at my limit.)

So... What can I do to convince my triangle to work?

Comment
Add comment · Show 8
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 hoy_smallfry · Mar 01, 2013 at 01:46 AM 0
Share

Is your $$anonymous$$eshCollider's isConvex property set to true? That may be the issue. It gets too complicated for physics to calculate collisions if there's a chance that meshes can be concave shapes. the isConvex property constructs a new mesh from the mesh you gave that ensures its convex; sort of like putting shrink-wrap on something.

avatar image Jesdisciple · Mar 01, 2013 at 01:58 AM 0
Share

@jbarba Convex doesn't seem to change anything. However, I tried swapping which mesh does what and then I get this problem on the other mesh (a semi-circle) while the triangle works fine. Pending a way to get Unity to cooperate, I'm writing code to just call Stay and Exit myself according to Bounds.Intersects. The number of colliders I'm concerned with is sufficiently small that this isn't insane.

avatar image Julien-Lynge · Mar 01, 2013 at 03:06 AM 0
Share

Are you moving things non-physically, e.g. by changing transform.rotation and transform.position directly?

avatar image Eric5h5 · Mar 01, 2013 at 03:13 AM 0
Share

Changing the position directly doesn't prevent any of the collision/trigger messages from firing. In fact I rely on that as a way to hack around the fact that destroying on object doesn't cause Exit to fire.

avatar image Julien-Lynge · Mar 01, 2013 at 03:25 AM 0
Share

Good to know. $$anonymous$$y understanding was that moving by changing the transform was non-physical and instantaneous, thus it would break collision detection (which calculates along the path traveled). I'll have to take another look.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by sparkzbarca · Mar 07, 2013 at 09:41 AM

you should read the documentation. http://docs.unity3d.com/Documentation/Components/class-MeshCollider.html

first off for 2 mesh colliders to colilde they both must be marked convex.

You also need to look at the very bottom of the page and line up what kind of collider the semi-circle is and what kind the triangle is (for example one of them MUST HAVE a rigidbody). In order for this to work.

Anyways your answer is all there in the documentation on mesh colliders.

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 Jesdisciple · Mar 07, 2013 at 02:09 PM 0
Share

In all of my tests, the other collider is a primitive (sphere within the game, box in my test case). $$anonymous$$y apologies for not mentioning that; I hadn't realized it was important.

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

13 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

Related Questions

Trigger script does not work. 1 Answer

Mesh Collider Does Not Working 1 Answer

OnParticleCollision equivalent as a trigger 0 Answers

30 Collisions with tags alone 1 Answer

Character Controller collision on Mesh Colliders Slopes Issue. 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