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 Roguespectre101 · Oct 18, 2012 at 05:36 PM · collisionworkno

Collision will not work

Hey guys I've put this collision code onto a bullet prefab in my game however it keeps on giving me the same response.

The error it gives me is Script error: OnCollisionEnter This message parameter has to be of type: Collision The Message will be ignored

In my scene there are objects that can be collided with because they have mesh colliers and I also have a terrain in the scene as well. here is the code.

 var Target : GameObject;
 var ObjectName : String = "Bullet";
 function OnCollisionEnter(collision : Collision){
 if (collision.gameObject.tag == ObjectName){
     ("Collision.gameObject.tag equals " +collision.gameObject.tag);
     Destroy(Target);
     Debug.Log("target hit");
 }
 }

So yeah someone please help because I'm running out of options that should work but don't I am also currently using the latest version of unity as well.

Comment
Add comment · Show 6
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 whydoidoit · Oct 18, 2012 at 05:53 PM 1
Share

Do you have a script called Collision.js?

avatar image Sonaten · Oct 19, 2012 at 03:57 PM 0
Share

I have had good experiences with OnTrigger functions. Consider if these can work as a solution.

avatar image Roguespectre101 · Oct 20, 2012 at 09:47 PM 0
Share

Do you think I should change the name of the collision script to something else and that might solve the issue.

avatar image whydoidoit · Oct 21, 2012 at 10:59 AM 0
Share

Yes! That'll do it

avatar image Roguespectre101 · Oct 21, 2012 at 05:11 PM 0
Share

ok It did do something the script is now called BulletCollision and it doesn't give me the error message anymore but it still doesn't seem to register when ever it hits anything; got any ideas.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Pankaj Yadav · Jan 31, 2013 at 05:33 AM

Motion of body should be by force or velocity..

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

13 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

Related Questions

A node in a childnode? 1 Answer

Collision problem 0 Answers

Creating a draggable object - and defining areas. 1 Answer

Simple Collision with children of other GameObject doesnt work 1 Answer

Adding collision detection to movement script... 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