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 Tea_Doogun · Nov 20, 2012 at 06:44 PM · triggertagsimported

Trigger not registering imported objects

My scene is made up of many objects, some imported, some simple Unity shapes.

I have an IMPORTED cylinder which moves around the scene, 'Is Trigger' is enabled on the cylinder.

The cylinder has a script which does different things depending on the Tag of the object it moves into.

Here's the problem: It doesn't register any of the imported objects, only the Unity shapes (cube, sphere, etc.). Why is this? Can it be fixed or do i have to apply box/sphere colliders to everything?

  • All imported models are .FBX

  • 'Import Colliders' is activated in the 'Import Settings'

  • The colliders of the imported items react fine against other colliders and raycasts...it's JUST when i try to have my trigger react to them.

I'll put an example of the code below, but i'm pretty sure it's fine:

 function OnTriggerEnter (trigger : Collider)
 {
 if (trigger.gameObject.tag == "missile"){
 Debug.Log("DESTROY MISSILE BOOOM!!");
 }
 
 if (trigger.gameObject.tag == "roof"){
 Debug.Log("DESTROY ROOF BOOOM!!");
 }
 
 if (trigger.gameObject.tag == "building"){
 Debug.Log("DESTROY BUILDING BOOOM!!");
 }

Thanks, Tom :)

Comment
Add comment · Show 1
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 Tea_Doogun · Nov 27, 2012 at 05:21 PM 0
Share

Forgot to mention that the cylinder is imported from Blender, NOT an actual Unity shape.

Edited the post and slapped myself in the face.

BU$$anonymous$$PETy-BU$$anonymous$$P-BU$$anonymous$$P!!

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Loius · Nov 27, 2012 at 06:03 PM

If you want this object (Object A) to be triggered by Object B, then:

A must have a collider set to IsTrigger, and a rigidbody set to kinematic.

B must have a collider, and a rigidbody set to kinematic. Do your objects have colliders? Double-check that.

In Edit > Project Settings > Physics, the layers on which A and B are {pause} must be set to be able to collide.

Add a Debug.Log("Hit object " + trigger.name) to see every object which A hits. Your objects may not be tagged properly.

Imported objects and Unity primitives have absolutely no difference in implementation.

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
avatar image
0

Answer by cowlinator · Nov 20, 2012 at 09:11 PM

Do you have rigidbodies? Attach Rigidbodies to all the colliders that move. "Colliders that move should always have Kinematic Rigidbodies". (http://docs.unity3d.com/Documentation/Manual/Physics.html)

Comment
Add comment · Show 1 · 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 Tea_Doogun · Nov 21, 2012 at 12:18 PM 0
Share

Yeah, it does have. The other objects in the scene also have kinematic rigidbodys.

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

11 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

Related Questions

Ball activating triggers even with a script 0 Answers

Trigger that reacts to different tags? C# 1 Answer

Trigger enter in single direction ??? 3 Answers

VR : How to check if object held passed through trigger Zone 1 Answer

Can't click gameobject when over another trigger? 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