- Home /
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 :)
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!!
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.
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)
Yeah, it does have. The other objects in the scene also have kinematic rigidbodys.
Your answer
![](https://koobas.hobune.stream/wayback/20220613084207im_/https://answers.unity.com/themes/thub/images/avi.jpg)