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 AntLewis · Jan 08, 2013 at 05:34 PM · collisionrigidbodies

Collision question

Hi, I'm a little confused about rigidbody collision. I have a static mesh collider, with OnTrigger set to true. When a rigidbody collides with it, the rigidbody passes through it without collision. However, Set OnTrigger to false and the collision is detected. I assumed the collision would still work, but it was the message sent (OnTrigger vs OnCollision) that differed.

The static mesh colliders are a series of static platforms, however there are physics objects in the game that I want to collide with these static mesh colliders - but I don't want give all of them rigidbodies...can anyone suggest a solution? BTW have been looking at this before someone points it out :-)

link text

Thanks in advance for any tips.

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
0
Best Answer

Answer by Bluestrike · Jan 08, 2013 at 06:00 PM

In Short: Oncollision uses contact detection and gives you info on the contact point. OnTrigger is used for invisible triggers like a trigger activating a trapdoor of special event in a level.

When you have a mesh and generated a collider for it you can attach a script to it that uses the OnCollosionEnter() OnCollisionExit and OnCollisionStay() functions. And youre mesh is solid and physics wil interact with it.

When you mark a collider as is trigger, the mesh is no longer solid but a trigger volume. You can use OnTriggerEnter() OnTriggerExit() and OnTriggerStay() functions. Usually trigger volumes to not have a renderer as triggers are generally invisible. Water could be an exception.

A rigidbody should only be given to physics objects like interactive crates. For static objects you just need a collider and rigidbody's will interact with it. For example: in a ball physics game, the ball would need a collider and rigidbody while other geometry like doors and the floor just need a collider.

Comment
Add comment · Show 2 · 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 AntLewis · Jan 08, 2013 at 06:10 PM 0
Share

Ok so when I flag an object with OnTrigger, I have to handle any 'collision' or behaviour in code with OnTriggerEnter etc. Alternatively, not having OnTrigger (as you say) means that the collision is handled automatically, but I can also detect this with OnCollisionEnter etc

avatar image Bluestrike · Jan 08, 2013 at 06:25 PM 0
Share

Yes with a trigger you get also different information back, a Trigger gives you the collder info wfrom the colliding rigidbody.

While the Collision gives you collision info like the point in space where the hot occured.

This may help you out: http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html

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

9 People are following this question.

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

Related Questions

Collisions While Rotating Objects Without Character Controllers 1 Answer

Collision between 2 complex rigidbodies 0 Answers

One-Way Collision Between RigidBodies 4 Answers

Not Quite Sure How OnCollision... Works 1 Answer

Collisions: do they need two rigidbodies? 2 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