particle direction to centre

Discussion in 'Programming' started by Kyon, Jul 11, 2018.

  1. Kyon

    Kyon Member

    Joined:
    Jun 27, 2016
    Posts:
    382
    Hi everyone,
    how would I set the direction of my particles to the centre of the emitter?
    So, I want to create this ellipse emitter, and use ips_distr_invgaussian to spawn then mostly at the edge of the ellipse.
    But I want the direction of the particles to be towards the centre of the ellipse. Is that possible?
     
  2. Kyon

    Kyon Member

    Joined:
    Jun 27, 2016
    Posts:
    382
    Alright I guess I solved it a bit, not using an emitter at all did the trick haha.
    So for the readers who got this problem too, what I did was this:
    Code:
                    var partdir=irandom(360);
                    var partdist=irandom_range(16,32);
                    var xxx=xx+lengthdir_x(partdist,partdir);
                    var yyy=yy+lengthdir_y(partdist,partdir);
                    var partdir2=point_direction(xxx,yyy,xx,yy);
                    part_type_direction(absorbpt,partdir2,partdir2,0,0);
                    part_particles_create(absorbsys,xxx,yyy,absorbpt,1);
    
    xx and yy being the centre and partdist being the distance from the centre
    (absorbpt and absorbsys are from my created particle system)

    So I tweaked it a bit and this is the effect in-game:
    [​IMG]
     
    arirish, Ido-f, TheSly and 1 other person like this.
  3. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    657
    Yeah, there are a few things like that within the particle system where you have to reset speed/direction/etc of the system for each time an individual particle is created. It's a bit CPU heavy but used appropriately it can yield good results (as can be seen by your screenshots).
     
    Kyon likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice