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 b4ux1t3 · Mar 17, 2014 at 06:19 PM · collisiontutorialexplosions

Tutorial: Space Shooter - 10 Collision not detected?

Let me quickly list the relevant attributes:

 Asteroid -> Rigid Body -> No gravity, no Kinematic
    ''    -> Mesh Collider -> Is Trigger
 Player   -> Rigid Body -> No Gravity, no Kinematic
    ''    -> Mesh Collider -> Is Trigger
 Player is tagged "Player"

 **Scripts**
 Destroy By Contact -> Explosion -> explosion_asteroid
         ''         -> Player Explosion -> explosion_player



Script "DestroyByContact.cs":

 using UnityEngine;
 using System.Collections;

 public class DestroyByContact : MonoBehaviour
 {
     public GameObject explosion;
     public GameObject playerExplosion;

     void OnTriggerEnter(Collider other)
     {
         if (other.tag == "Boundary")
         {
             return;
         }
         Instantiate(explosion, transform.position, transform.rotation);
         if (other.tag == "Player")
         {
             Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
         }
         Debug.Log(other.name);
         Destroy(other.gameObject);
         Destroy(gameObject);
     }
 }

Note: These settings and scripts match the video exactly, except where I added the Debug.Log.

Whenever I move my player into the asteroid, however, nothing happens. There is no collision detection whatsoever. And yet, when I fire a Bolt into the asteroid, it works perfectly fine, displaying the explosion and deleting both gameObjects.

What might be the problem here? I can't be the only one having this problem.

EDIT: Tutorial video here.

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 robcbryant · Mar 17, 2014 at 08:09 PM 0
Share

Is the asteroid exploding when it hits the player? Define "No collision detection whatsoever". -- I also don't see the mentioned video.

avatar image b4ux1t3 · Mar 18, 2014 at 01:54 AM 0
Share

I'm not sure I can be more unambiguous than the absolute statement "no collision detected whatsoever." Neither the Asteroid nor the Player detect any kind of collision. Both carry on with their day as if nothing happened.

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robcbryant · Mar 17, 2014 at 08:13 PM

You can also try unchecking "isTrigger" from the player object. I may be wrong--but I believe two triggers don't interact with one another--I think one of the objects has to be a nontrigger to register the collision. Are your bullets set as "isTrigger" ?

Edit: Two triggers can under certain circumstances-- http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html

There is a cheat sheet table at the bottom explaining the trigger interactions.

I think either your two rigid body objects need to be Kinetic or one of them needs to not be a trigger--probably the player. Have you thought about using a CharacterController instead of a rigid body for your player object? It's a lot simpler to use and control--and you're guaranteed to collide with all triggers using a character controller.

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 b4ux1t3 · Mar 18, 2014 at 01:58 AM 0
Share

I have tried toggling the "is trigger" a few times. One on, one off. The other on, the first off. Both on. Both off. None of those works. Same with kinematic. I've even done all four iterations of is trigger with all four iterations of kinematic. There has to be some setting somewhere that I clicked by accident. This is frustrating.

avatar image robcbryant · Mar 18, 2014 at 06:35 PM 0
Share

Here's a quick test: Are they actually colliding? I'm not being sarcastic--but if it's a 2D game maybe you accidentally set the player ship on a different z/y plane than the asteroids--ie. asteroids and bullets are on z = 0 but player is z = 1;

Check if the collider for the ship is 'checked' on.

If the collisions work with bullets then it's something to do with the ship.

avatar image
0

Answer by KacperM · Feb 21, 2015 at 02:53 PM

I had same problem - Mesh Collider check box on Player was disabled. After I enabled it asteroid and ship collide and everything works are it should.

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 TBone71 · May 21, 2015 at 05:56 AM 0
Share

I still have exactly the same problem. Even the finished scene by Unity (Done_$$anonymous$$ain) has the problem of the player not colliding with the asteroids. I am using Unity 5.0.2f1 Personal. $$anonymous$$aybe the project was build on an older version of Unity and has compatibility issues?

Can anyone help?

Thanks!

avatar image TBone71 · May 21, 2015 at 06:45 AM 0
Share

I just found the error to the my above problem. The 'convex' box was not ticked in mesh collider of the Player, which is not allowed in Unitiy 5.0.2, if the 'is trigger' is ticked. So the solution was simple, just tick the 'convex' box in the mesh collider of the player in prefabs.

avatar image
0

Answer by Old_Badger · Jan 07, 2017 at 08:27 PM

I had the same problem using Unity 5.5 for linux. After much searching and clicking make trigger and convex, I found I had the mesh collider for the player deselected. DOH!

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 Percefane · Mar 19, 2017 at 05:02 PM

Hello,

I had the same issue. The boxes ticked, in my cases, were in the "Rigidbody" tab, under the "Constraints" and "Freeze Position Y", "Freeze Rotation Y".

When I unticked them, the collision worked!

Hope this can help some of you!

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

25 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

Related Questions

Collision detection not triggering 3 Answers

Yet another Audio on Collision issue 1 Answer

Lerpz tutorial problems 2 Answers

Survival Shooter: Missing Collision Detection? 2 Answers

Parenting tutorial 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