- Home /
Adding a collider to a lightning script that has a constantly changing size
Hello everyone and thank you for checking out my question.
Currently I am making a game where you control 2 round objects and once they get within a certain distance from one another a lightning effect will appear in between them.
The lightning script is inside a prefab right and I'm controlling the switch for it via another script in another prefab.
I want to make a collider for that lightning effect that would allow me to detect objects that hit it. Kind of like the laser trip wires you see in spy movies. I've tried adding a collider to the prefab that contains the lightning script but can't find a way to make it follow the size and location of the lightning effect.
I've also tried attaching an edge collider that connects the 2 round objects which does give a collision in the middle but made it impossible for the left object to go to the right side and vice versa.
I'm quite new to unity and programming and would very much appreciate any help.
Thank you
P.S. I got the lightning effect from the asset store. here is a photo of it in the inspector.
Your answer
Follow this Question
Related Questions
Can you trick a Ui Button that it is being clicked with code? 3 Answers
How do I use collisions for player/enemy interaction 2 Answers
Change the material ELEMENT on an Object in a script? 1 Answer
Making an object realistically rebound off walls 1 Answer
What is the best way to detect collision?? Raycast2D, OnTriggerEnter2D, OnCollisionEnter2D 1 Answer