How make long range spell effect with collisions (flame thrower effect)
I want to make a spell that will act like a flamethrower. The spell must collide with other objects to apply a fire effect and / or deal damage.
The visual effect itself can be obtained with particle system. The problem is how to get a collision even when the flame bends at different angles (when the player spins during the spell).
I need just idea how to do it or example. :)
While particle system does come with both collision-triggered event and subemitter module, they can be unreliable and performance taxing if you emit tons of flame particles to collide. Sanely speaking, just do a raycasting from your player character and use it to instantiate a “hit” particle effect.
How achieve effect of bending fire in this approach? I will need to send raycast every "shot" or every second and I think it will be not accurate when character spin. But I can be wrong. Can you provide more information about your idea? Because maybe I misunderstood your idea.
I would create a Collider (either a $$anonymous$$eshCollider if you have "complex" shape, or a simple capsule collider) you can attach to the entity responsible for your spell.
Sounds simple, but there is problem with collision when player spins and flame bends.
Answer by JusSumGuy · May 22, 2018 at 04:25 PM
Use a sphere gameobject and add the particle system/Trail renderer component to it. So then you can just use a sphere collider. You can use more than one sphere too at different sizes. For example the flame thrower can shoot out a few medium sized spheres with the particle system and a trail renderer attached. Then you can say onCollision(){ destroy medium spheres and instantiate a bunch of little spheres} to make it look like the fire is spreading in random directions. For the fire going around a player and bending effect, you can write a script for the spheres to circle around a target object at a random radius, to give it that chaotic fire look. With the particle system and trail renderer done correctly the player wont be able to see the actual sphere's and the collision system wont be very demanding. That's how I would approach it at least, hope this helps :).
Your answer
Follow this Question
Related Questions
Can I shoot a ray from a particle that hit a collider? 1 Answer
How do I make my particle system detect/mark a floor collision? 0 Answers
OnParticleCollision Instantiate Collision Normal 1 Answer
Can't find a way to add particle effects to a collision 2 Answers
Particle Collision between particles 0 Answers