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 Alienjesus · Feb 28, 2011 at 07:17 PM · rigidbodycollidertriggerlayers

Trigger Collider not detecting game objects?

Hi, I'm making a game where a marker tracked by a camera can be used to manipulate the game environment. To do this, I have an object that moves in relation to this marker in 2D space. In order to pick up objects behind the marker (in 3D space), I have attached a box trigger collider to it to detect objects in the same x,y co-ordinates at different depths. However, I'm having issues getting it to detect anything.

function OnTriggerEnter (other: Collider) { //if ( other.gameObject.layer == "moveable" ) Debug.Log ("Object Found"); }

function OnTriggerStay (other : Collider) { }

function OnTriggerExit (other : Collider) { Debug.Log ("Object Not Found"); }

This is my code attached to the trigger box, which seems pretty standard as far I can tell. At the minute, I have several crates and the lerpz character from the 2D game tutorial in my scene. The trigger only detects lerpz, and cannot find any of the crates when they collide with it. If I activate the code which also searches for the layer tag, it can no longer sends out the "Object Found" message for anything, even Lerpz. It does however still send out the "Object Not Found message when he moves out of it.

So the things I'm struggling with: 1. Why won't the trigger detect the crates? They're rigidbodies with box colliders. 2. Why can it detect lerpz? Lerpz doesnt seem have a collider at all, and I thought both objects needed on for a trigger to activate. 3. Why can I no longer get the Object Found message when I add the code for seperate layers? Why does it still give me the object not found?

All help would be appreciated! Thanks!

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

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

No one has followed this question yet.

Related Questions

Simple Triggers problem. 1 Answer

Rigidbody2D alternating between TriggerEnter and TriggerExit? 1 Answer

isKinematic rigidbody collisions 3 Answers

col.gameObject.layer is not working 1 Answer

Layers, parenting and collisions. 0 Answers


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