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 /
avatar image
0
Question by SPOTNINJADUD7890 · Oct 23, 2016 at 05:28 AM · c#unity 5collisioncollision detectionridgidbody

Not detecting collision?

     void OnCollisionEnter(Collision col){
         if (col.gameObject.tag == "Arrow") {
             Debug.Log ("we should die now");
             Die ();
         }
     }

but when the player gets hit by the arrow it doesn't call die or the debug.log.

i don't know why this is not working.

Comment
Add comment · Show 11
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 SPOTNINJADUD7890 · Oct 23, 2016 at 06:02 AM 0
Share

does anyone know what is going on?

avatar image b1gry4n SPOTNINJADUD7890 · Oct 23, 2016 at 06:04 AM 0
Share

"when the player gets hit"

if that were true you would see the debug log, so the player couldnt be getting hit. Check your physics matrix. $$anonymous$$ake sure you have a rigidbody on the object

avatar image SPOTNINJADUD7890 · Oct 23, 2016 at 06:18 AM 0
Share

the player does have rigidbody and the arrows do stop when they hit the player.

avatar image tanoshimi SPOTNINJADUD7890 · Oct 23, 2016 at 06:20 AM 0
Share

A non-kinematic rigidbody? and both the player and arriw have colliders not marked as triggers?

avatar image SPOTNINJADUD7890 tanoshimi · Oct 23, 2016 at 06:24 AM 0
Share

the ridgidbody is kinematic and are the colliders suppose to have triggers?

Show more comments
avatar image SPOTNINJADUD7890 · Oct 23, 2016 at 06:33 AM 0
Share

the ridgidbody is kinematic and are the colliders suppose to have triggers?

avatar image tanoshimi SPOTNINJADUD7890 · Oct 23, 2016 at 06:40 AM 0
Share

No... read my last comment. NOT kinematic. Colliders NOT triggers.

avatar image pri0ritize · Oct 23, 2016 at 06:53 AM 0
Share

$$anonymous$$inematic means the rigidbody is working outside the Unity physics system. Is that your intention? Is your Debug statement working? Is there a reason you're not using GameObject.CompareTag()?

avatar image SPOTNINJADUD7890 pri0ritize · Oct 23, 2016 at 03:48 PM 0
Share

I just need it to check if the tag of the object it was hit by is "Arrow".

avatar image nj4242 · Oct 24, 2016 at 05:48 AM 0
Share

Is it in 2D you're working on?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SPOTNINJADUD7890 · Oct 23, 2016 at 04:01 PM

 void OnControllerColliderHit(ControllerColliderHit col){
     Debug.Log ("Called");
         if (col.collider.tag == "Arrow") {
             if (GetComponent<PhotonView> ().isMine) {
                 Debug.Log ("we should die now");
                 Die ();
         }
     }
 }

I switched to that but now its calling the debug but when i hit the arrow it still does not work.

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 SPOTNINJADUD7890 · Oct 23, 2016 at 04:32 PM 0
Share

the first debug.log("called") is calling but when i touch the arrow nothing happens please help!

avatar image pri0ritize · Oct 23, 2016 at 05:39 PM 0
Share

Are you calling the OnColliderHit function from the arrow or from something else?

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

258 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 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 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 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 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 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 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 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 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

How to detect collision on only one side of an object? [C#] 4 Answers

Resize Array Based on Value 2 Answers

Check for collision while animating 0 Answers

Multiple Cars not working 1 Answer

if statement not working when detecting collision between two prefabs 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