Not sure why it’s on the camera, but put a rigidbody on the object with the trigger. I’m assuming you already set the collider to a trigger (with the checkbox) and also use “Is Kinematic” (check the box in the rigidbody options, and might as well uncheck Use Gravity) so the system doesn’t waste time calculating physics on the object.
The MeshCollider on the object doing the colliding needs to have ‘IsTrigger’ turned off, while the MeshCollider receiving the collision needs IsTrigger turned on. Try making that change and see what happens.
Hm? That’s how it’s already setup. The objects that are colliding are NOT triggers. The object that is emitting from the camera (the cone, that I want objects to collide with) is a trigger.
Edit: I set up a sphere the same way my mesh is setup and it works… so the problem lies with that cone I imported from Maya.
Edit2: Unparenting it from the camera works. But I need it parented to the camera…
Edit3: Because the parent object (character - which the camera is under, which the cone is under) has a rigidbody, it will not detect collisions on child objects…?
By the way, just to be clear: only one of the objects that are part of the collision need a rigidbody (the player OR the cone).
Also, I’m not sure if triggers are meant to move like that. You may just want OnCollisionEnter- however, I am not an expert on this, but you may as well as try that as you wait for someone with more experience to respond.
Triggers can move, but when you have lots of movement you almost certainly then want to have the Collision Detection on the RigidBody set to Continuous.
I edited my response without refreshing, doh, anyway, because the player has a rigidbody the child objects’ rigidbodies wont work. So this means the player needs to be set to trigger? I don’t want him to be a trigger…
Edit: Guess I’m still confused. Why is my collision not working? The parent object actually doesn’t have a mesh collider at all because it’s an empty node with the scripts on it.
You guys are trying to explain why it wont work but there is no solution to the problem then?
Is the player colliding into the cone, or is the cone colliding into the player? (The best setup is for the player to collide into the cone and other objects, not the other way around.)
The cone is being used instead of a ray to cover a wider area. Anything that enters the trigger fades out, and OnTriggerExit to fade back in after… The player’s collision will not be considered once I’ve scripted it in.
Maybe I’m doing everything wrong, who knows. I’m new to this.
That’s how I’ve been doing it already, though. And like I said, it works if it’s not under a parent. The issue is the parent, not the collider or trigger. There’s nothing on the parent I can change without screwing my character.
Create a GameObject, make it a child of the Player, and put the RigidBody and colliders on that. Then the player will appear to collide with the object. This is a very common method used in many game engines.