Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
9
Question by IKilledKenny_2 · Jan 13, 2015 at 06:55 PM · javascriptcollisionrigidbody

OnTriggerEnter Or OnCollisionEnter?

Hello Unity3D.I have a question about collisions.Which Collision Method is best for a Fighting Game OnTriggerEnter or OnCollisionEnter?The reason i ask this question is that fact that i hear some people say OnTriggerEnter is better and some please also say OnCollisionEnter is Better?If one is indeed better than the other or if they both are needed?Can anyone explain to me why?

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

3 Replies

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

Answer by Bentoon · Jan 13, 2015 at 07:01 PM

Great question Was just reading up on it myself: http://docs.unity3d.com/Manual/CollidersOverview.html alt text


screen shot 2015-01-13 at 2.01.27 pm.png (208.0 kB)
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 IKilledKenny_2 · Jan 13, 2015 at 08:40 PM 0
Share

$$anonymous$$y guess would be the pros and cons of OnTriggerEnter And OnCollisionEnter

avatar image
23

Answer by tanoshimi · Jan 13, 2015 at 07:10 PM

One is not "better" than the other; they do different things. OnCollisionEnter is called when two colliders hit. OnTriggerEnter is called when a collider enters a trigger (i.e. a collider with "IsTrigger" set).

True "collisions", used in conjunction with non-kinematic rigidbodies, are for when you want to simulate the physical effects of two objects colliding - the conservation of momentum, forces applied based on the angle of incidence etc. OnCollisionEnter is called when these objects first hit each other and gives you properties of the point of collision, but the physics engine itself automatically resolves changes in motion of the two bodies etc.

OnTriggerEnter is used (with kinematic or non-kinematic rigidbodies) to detect when one object has entered another's trigger. Note that, in this case, the physics engine does not prevent the object from doing so - unlike a collider, you do not "bounce off" a trigger. It can be thought of as an invisible "zone", and you can decide what happens to the object having entered that zone.

Either can be used for a fighting game - it really depends how you are planning to control the kinematics of the characters.

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 IKilledKenny_2 · Jan 13, 2015 at 08:39 PM 0
Share

OH....So both of them can be used but it just depends on how i used them in my game that i am creating?

avatar image ismaelnascimento01 · May 21, 2017 at 01:16 AM 0
Share

Very good explication !

avatar image patrickabroad · Aug 06, 2017 at 02:54 PM 0
Share

Thanks, tanoshimi. That cleared it up for me.

avatar image
0

Answer by merlin4 · Feb 22, 2021 at 02:00 PM

Neither. You want to use Raycast/Linecast/Boxcast etc to actually tell if in attack hits generally.

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

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

30 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

Related Questions

AddTorque Isn't Working? 1 Answer

Dragging object out of position 2 Answers

Parent rigidbody using its childrens colliders. Should it work or am I stupid? 2 Answers

Collsion without ririgibody 1 Answer

Player Falls Through Floor on Trigger 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