Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Remedous · Sep 28, 2015 at 06:38 AM · 2dcollision

How do I get objects to detect collisions?

I am creating an endless runner. I need to be able to know when the player has hit the spikes. I've tried OnCollisionEnter, OnTriggerEnter, turning off and on "is trigger", I've messed around with the tags and layers, I've tried putting the detection script on both the player and the spikes and nothing seems to work. I've seen plenty of tutorials where they'll just throw down one of those and it works which makes want to know what's so different about mine? The only thing I think I can really do is just upload my game in it's entirety to so that you can see everything. I'll do my best to clear anything up.

Comment
Add comment · Show 4
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 Cherno · Sep 28, 2015 at 10:59 AM 0
Share

If an object that has both a non-kinematic RigidBody and a convex, non-trigger collider is stopped by another objects which has a non-trigger collider, and they are both in layers that are set to register collisions between them (Physics settings), then you know that collisions are registered. Are all of the conditions listed above true for your setup?

avatar image Remedous Cherno · Oct 01, 2015 at 07:59 PM 0
Share
  1. the player has a non-kinematic rigidbody

  2. I'm not sure what a convex is

  3. The player has a non trigger collider

  4. the spikes have non trigger colliders

  5. I'm not sure how to edit the layer physics, I found the "edit layers" inspector, but I couldn't find anything about it's physics, I set them both to the default layer in the hopes that that would be automatically set for me.

avatar image Cherno Remedous · Oct 01, 2015 at 08:21 PM 0
Share
  1. $$anonymous$$eshColliders can be set to convex. For the meaning of the world, check Wikipedia.

  2. Edit -> Project Settings -> Physics

I also suggest you learn to use the Unity Scripting API and Unity User $$anonymous$$anual, lots of useful information in there, especially for beginners.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by JA_555 · Oct 01, 2015 at 08:26 PM

If you still haven't solved it, I guess there is always the option of doing it by distance. For example, you could attach a script to the spikes that say, if the players distance is less than one, add damage.

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 syscrusher · Oct 02, 2015 at 05:42 AM

Check the colliders overview page in the Unity manual. There is a table with very detailed information on what collisions are and are not reported. Your situation is collisions, no triggers (there are two tables).

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

6 People are following this question.

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

Related Questions

How to show an object when collided with 0 Answers

Is it possible to control prevent/enable colisions based on the value of a variable. 2 Answers

Jitter with Tilemap Collider's but no Jitter on standard Box Collider 1 Answer

Can't make the character and ground collide (2d). 3 Answers

[c sharp] why isn't my player dying when it touches the truck? 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