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
1
Question by rule62 · Jul 04, 2012 at 12:07 AM · physicsrigidbodycolliderontrigger

OnTriggerEnter - Objects pass through each other?

I have 6 primitive cubes stretched out to form the "walls" of a large box. Inside the box, I spawn some number of primitive spheres with random velocities.

I have colliders on the cubes ("walls") and on the spheres.

I have rigidbodies on the spheres but not the cubes.

When I press PLAY, everything works fine. The balls spawn and go bouncing happily about the inside of the box.

But, if I set the tick mark for "Is Trigger" on the spheres, all my spheres go sailing right through the walls of my box. Nothing is being destroyed... except the physics of the collision itself.

I'm not sure what is causing this or how to prevent it.

Comment
Add comment · Show 2
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 Linus · Jul 04, 2012 at 12:20 AM 0
Share

Have you tried giving the boxes rigidbody, just for testing.

avatar image rule62 · Jul 04, 2012 at 12:47 AM 0
Share

Thanks Linus, but adding a rigid body to the "walls" (cubes) has no effect. :(

3 Replies

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

Answer by whydoidoit · Jul 04, 2012 at 03:50 AM

Just to be clear - setting isTrigger means that you do not want the collisions to happen in the physics system - you just want to be notified.

Triggers are used to provide a way of activating something when the character is in a particular location by using colliders but without those colliders having a physical impact.

I presume that you want to be notified about the collisions and have them provide a physical impact - in this case you need to use OnCollisionEnter routines (not the Trigger ones).

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 rule62 · Jul 04, 2012 at 04:26 AM 0
Share

Ah. Thank you for the clarification.

avatar image
1

Answer by Maru07 · Jul 04, 2012 at 12:16 AM

I hope I got u right^^ Make 2 different colliders. For example 1 sphere collider and a box collider which you set as Triger. As soon as it is a trigger, it ignores collisions between other gameobjects so you need a constant collider.

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 rule62 · Jul 04, 2012 at 12:57 AM

If I follow Maru07's suggestion, I get the behavior I want. I have to create an empty gameobject, give it a collider and rigidbody, then make my sphere/ball a child of this gameobject.

It works, but it's not exactly an elegant solution.

Thanks Maru07.

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 Maru07 · Jul 04, 2012 at 01:09 AM 0
Share

Sure thing^^ Well, as long as it does its job... I cant find an other way to do that. Is Trigger false would be too late and it would go crazy with your box. This is the propper method to archieve this kind of behavior. At lest my propper method :D

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Camera gets flung off of the map when the player collides with certain objects. 0 Answers

Ignore sub-colliders for center of mass in Rigidbody2d? 1 Answer

Physics question 1 Answer

Physics Possibilities?: Angles, Penetration, Exceptions 4 Answers

ball's collider sometimes catches an edge and bounces. when ball rolls over two aligned platforms 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