What i want to do is when my character go near the diamond, the diamond is destroyed and disappeared. But the below code doesn’t do anything when the main character go near the diamond. What happened?? What wrong with the code.
I tried but there is no effect. The diamond is not destroy when the character collide with the diamond.
Anyway i might have many collision. Should i use the same “hit”?
Check if you’re diamonds are actual triggers by going into the collider component and checking ‘Is Trigger’, everything else should work… with what Nomad said.
Yes. I have already click on the “Is Trigger” for the diamond. For the diamond, i have mesh collidor and sphere collidor. I wonder which one should i click for " is Trigger"? And for the script above, this one is attached to the character.
Mesh colliders use more cycles - if anything - box or capsule. Keep it simple - no need to calculate more vertices than you need. You don’t need more than 1 collider from what you’re telling me.
Yes, you are right, it is just an item pickup. I have clicked “is trigger” on the mesh collider but i don’t know why the diamond fall infinitely on the Y position?
Yes, you are right, it is just an item pickup. I have clicked “is trigger” on the mesh collider but i don’t know why the diamond fall infinitely on the Y position?
delete the mesh collider on the diamond. you don’t need it its it’s too intensive. use a sphere collider or cylinder collider; make sure the collider’s radius is a decent size so you don’t have to be standing inside the diamond. This is to be marked as a trigger collider. Put a print statement inside hit collision to make sure it firing, remove print statement when done. Make sure you have a regular collider on your character.
I am assuming the trigger is on the diamond with a descent size radius. Your script should be on the character controller, not the diamond