This project is read-only.

FireTrigger Failing to Set 2D Particle Location

Jan 20, 2012 at 9:58 PM

I am tinkering with tutorial 21 ParticleSystem2D.  What I want to have happen is the particle be emitted at coordinates specified at run time. 

protected override void Update(UpdateState state)
{
        ...

        Vector3 tv3 = new Vector3(0.8f, 0.8f, 0.8f);
        Vector3 mouseCoords = new Vector3(x,y,z);
        this.particles.GetTriggerByName("trigger1").FireTrigger(ref tv3);

}

 

In the modified .particles file I removed the <frame> section and added a <triggers> section.

<triggers>
     
      <trigger name="trigger1"  allocation_multiplier="1">
        <emit type="firework" life="1.5" life_variance="0.5"/>
      </trigger>
     
    </triggers>

and I commented out <!--<add target="position.x" arg0="local0"/>-->

However, the particles insist on emitting from the bottom center.

In my Update function I tried adding "particleDrawer.Position = new Vector2(0.8f, 0.8f);", with no change in behavior.

Can someone please give me some guidance on how I am supposed to set where the next particle will be emitted, from my code?