Question: Creating a cone shaped frontal AOE.

TLDR Question1: How do I create a frontal AOE in a cone shape in C#, that would work with my current code.
TLDR Question2: How do I make the particles work with said AOE.

Hi… First a little about myself. I’m a 3D Graphic Artist who codes Android apps in my free time, mostly just ease of use apps, and I have a pretty good understanding of Java using the Android SDK. As of last week, I decided to tackle the challenge of making an Android game using Unity, and using the Fury Framework Asset as a sort of backbone to the game. All my knowledge of coding is self taught, so extremely vague answers might provide insight, but not really help with my current problem… But any help is appreciated :slight_smile:

For question one, I’m trying to get the effect of a frontal AOE spell… Exactly like in this picture :
1349577--66331--$second+skill+incinerate.jpg

Currently, I use this code for my normal targeted AOE:

public override void OnEndCast(object tag, Fury.Behaviors.Unit caster, Fury.Behaviors.Targetable target, UnityEngine.Vector3 position)
    {                        
        caster.ModifyEnergy(EnergyType, -EnergyCost);
        // Iterate through all unfriendly commanders
        foreach (var cmdr in Fury.Behaviors.Manager.Instance.Commanders)
            if (!caster.IsTeamOrNeutral(cmdr))
                // Iterate through all units of unfriendly commanders
                foreach (var unit in cmdr.Units.Values)
                    // Check if unit is inside the radius
                    if (Vector3.Distance(unit.transform.position, position) < Radius)
                    {
                        //satk formula
                        var totalSatk = 0;
                        foreach (var stack in caster.Controllers.TokenController.Stacks)
                            if (stack.Token is Level  stack.States[0] > 0)
                                totalSatk += (stack.Token as Level).Sattack;
                        //Damageing units
                        (unit as Fury.Behaviors.Unit).ModifyHealth(-(Damage + totalSatk), caster, this);
                        // Apply status effect if set
                        if (StatusEffect != null)
                            unit.AddStatus(StatusEffect, caster);
                    }

I have tried every combination of code I could think up to get the desired effect, but no luck so far :expressionless:

For question two, I’m trying to get the particle effects to emulate said AOE spell. I have the particles built, and as a stationary object they work fine… but when I attach the particles to the spell, they stay centered on the character and I can not move them. I’d like to have them work like in the above picture.

This is the code I use for my particle effect:

        if (Effect != null)
        {
            var effect = (UnityEngine.GameObject)UnityEngine.GameObject.Instantiate(Effect);
            effect.transform.position = caster.collider.bounds.center;
            effect.transform.parent = caster.transform;

        }

As well as the above code, I have tried numerous variations of the code to try to get the desired effect, but with no results :frowning:

I hope this isn’t a stupid question, or something really simple that I just completely overlooked >_<
Any help is appreciated!

Anyone? :frowning:

Cone shaped particle emitter and getting collisions from the particles with enemy could work. Or trigger collider adjusted to the particle area, if you find the particle collisions too unaccurate.

And for the moving problem, you need to set the position constantly or just parent the spell object to the player (as from your code you seemed to only set the position once…)

I use a Physics.OverlapSphere based method to get all units within range, then calculate the angular differences with the caster’s forward direction (vector 3), if the angular difference is within the pre-defined range, then apply effect. Though i suspect that Unity does not use any optimization, so it might be as computing heavy as your code that iterates through all enemy units, if not worse. (Hope that is not the case)

Personally I use hitbox’s made to the shape that I desire (a collider + a script). If something is in the hitbox I check if I can hit it (teams, isActive, that sort of thing), then if I can I do damage.

I separate all my effects (particles, meshes, etc.) from the actual damage hitbox that way I have more modularity. If I change one it doesn’t require me to change the other.