- Home /
particle system's collider doesnt work
Hi everyone,
I'm trying to use particle system with collider in my project. The aim is destroy barrier with fire (using collider) But I have slight problem here. when I hit something with particleSystem's collider, the code going to "SnakeHead" collider which is particleSystem's parent. you can see on below the system.
Any idea?
Many thanks.
So what you wanna do ? I didnot understand this link "The aim is destroy barrier with fire (using collider) " What is code of snake?
Sorry about my english :)
In normally when snakeHead hit the white ball (barrier) ,the game will over. I wanna added a fire (which is particle system). When I use fire function, I can destroy the barrier thats why I use collider on particle system.
When I seperate snakeHead and particle system it works but when I use snakeHead as a parent for particle system, it doesnt work. because the system get particle system's collider as a snakeHead's collider.
What I understood is that you have a "barrier" (something like a wall?) that should be between the white ball and the head of the snake. Initially, going through the barrier will kill the snake and end the game. Unless the player presses a button which will release the fire and that is supposed to destroy the barrier?
Answer by AshwinTheGammer · Oct 04, 2017 at 12:00 PM
I think you`re saying that you want to destroy the barrier with fire when snake collide with barrier so first of all add then Particle System to Barrier and then tag the barrier with name"fire" and then in snake put this line :
void OnCollisionEnter(Collision col){
if(col.gameObject.tag == "fire"){
Destroy(col.gameObject);
}
}
Make sure that you have default collider added to barrier See the image for info
I hope it will help you :)
I put under the SnakeHead because I want to make that the particle system is being a part of snakeHead (for getting position automatically and etc. :) )
I still didn`t understand why are you putting the particle system in snake`s head what is the meaning of this line "for getting position automatically and etc. " what is ur main problem pls simplify it more.
Your answer
![](https://koobas.hobune.stream/wayback/20220612140217im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can't click gameobject when over another trigger? 1 Answer
Using two trigger colliders 1 Answer
On Collide script not working! 1 Answer
Trigger Spawning? 1 Answer
Temporarily ignore collisions between player and enemies 2 Answers