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
1
Question by aleem.razzaq09 · Nov 26, 2013 at 06:55 AM · collisionrigidbodyunity4.3

OnCollisionEnter not called on Unity4.3 for 2D.

Hi, I have two 2D object, one is use to throw by catapult and then it hit other 2D object. Both have collider and Rigidbody both have unchecked isKinetic and isTrigger. When they collide with each other then OnCollisionEnter method doesn't call and script is attached to that object which is thrown by catapult. Kindly if any one face this problem help me on this. Thanks in advance.

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

Answer by clunk47 · Nov 26, 2013 at 07:15 AM

2D physics require 2D colliders. Replace Rigidbody components with Rigidbody2D, Colliders with 2D colliders. Replace OnCollisionEnter(Collider col) with OnCollisionEnter2D(Collider2D col).

Have a look HERE for further help.

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 aleem.razzaq09 · Nov 26, 2013 at 09:27 AM 0
Share

Thanks bro, Now getting bit issue when its collide I want to run animation onto second object, to show like it blast. I attached animation with that object and when I run code it gets crash. Here is what I am doing. declare string on top and call on collision. string blastAnim = "BlastAnim";

void OnCollisionEnter2D(Collision2D col){ Debug.Log("Collision Enter............."); animation.Play(blastAnim);

}

avatar image clunk47 · Nov 26, 2013 at 05:03 PM 0
Share

What do you mean when it crashes?? Do you get an Error? Do you get your Debug.Log message?

avatar image aleem.razzaq09 · Nov 27, 2013 at 05:56 AM 0
Share

I mean when this line of code run animation.Play(blastAnim); and it error is "EXC_BAD_ACCESS (code =1, address=0x0)".

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

17 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

Related Questions

Advice for Intersecting Colliders 0 Answers

Detect collider when same object contains more than on collider 1 Answer

Collision detection only half working. 1 Answer

Chain Reaction: Rigidbody that pushes rigidbody that pushes other rigidbody 1 Answer

A node in a childnode? 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