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 hubbyo9 · Feb 26, 2014 at 09:10 PM · box collideronline-scoreboards

Collider OnTriggerEnter not working

I have 2 objects a lazer and an asteroid, on the lazer object I have a small lazer hit script which is just

 #pragma strict
 
 function OnTriggerEnter(other : Collider) {
     Destroy(other.gameObject);
 }

The settings of my box collider are : is trigger = true center : 0,0,0 size = 5,5,1 Material = none

The settings of my asteroid sphere collider are: is trigger = false center = 0,0,0 radius = 500 material = none

I really do not have any idea why this does not work. I have tried almost everything. The lazer only moves with the ship which travels under 70m/s The asteroids are stationary. This question probably came up a lot but none of the answers worked for me. I have not tried ray casts yet though.

Comment
Add comment · Show 9
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 Dblfstr · Feb 26, 2014 at 09:13 PM 0
Share

I don't think they both need to be triggers. Also, they both need to be 3D objects (have non-2D colliders).

avatar image Dblfstr · Feb 26, 2014 at 09:18 PM 0
Share

Try setting only the box collider on the asteroid as a trigger. Also, make sure they are hitting each other. ( are in the same plane)

avatar image hubbyo9 · Feb 27, 2014 at 07:43 AM 0
Share

I am sure they are hitting each other and they are already 3d colliders, only one of them has their trigger enabled. And it still doesnt work if i change them around.

avatar image Berenger · Feb 27, 2014 at 08:02 AM 0
Share

Lazers are really fast and their trajectory is straight. Fast objects and collision detection is a bit tricky, you should use Physics.Raycast ins$$anonymous$$d.

avatar image Klarax · Feb 27, 2014 at 10:22 AM 0
Share

Im sure i had this issue with triggers destroying object. try putting it to OnCollisionEnter and take of the trigger check box on the collider on game object.

Did this work?

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

SphereCast not hitting the box bollider correctly 0 Answers

Box collider with rigid body yet enemies still pass through each other. 1 Answer

Move position of box collider using javascript 1 Answer

What is the best collider to use for a simple (1 quad) plane? 1 Answer

jumping and landing not very responsive 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