Math Magic required

BigDaveBigDave Member Posts: 2,239
edited December 2016 in Working with GS (Mac)

I want to have the particles moving in a circle instead of a fix line direction.
How?

Note: The actor has to remain at its fix position. So math magic within the particle direction expression.

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    @BigDave said:
    I want to have the particles moving in a circle instead of a fix line direction.
    How?

    Unfortunately particles can only move in a straight line.

  • SocksSocks London, UK.Member Posts: 12,822

    Although you can fool the eye into seeing things . . . here is a flag example (attached below) the particles are only ever moving in a straight line, but it looks like they following a more complex path, this might be useful for your needs, essentially you would be moving the spawner to make it look like the particles are moving in a nonlinear way.

    Another trick you can play around with is to have the particle image up in one corner of the image file (a particle image must always be square) - and when you rotate the particle and it moves at the same time, you introduce some (pseudo) nonlinear movement, attached below is a second file with an example of this - it's some atmosphere particles, I didn't like the linear nature of particles moving in straight lines, so this was an attempt to make them look more organic.

    I hope there is something useful in all this !

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    You could always create your own particle effect using real actors and then have full behavior control over them all. You'd have to be more concerned about lag with this method but I've used it before and if you're careful it can work out really well.

  • IceboxIcebox Member Posts: 1,485
    edited December 2016

    @Socks The flag demo is really something , didnt know you can do something like that , impressive, although i dont understand a thing with the abs and all the numbers you used :) Thanks for providing it very useful

  • BigDaveBigDave Member Posts: 2,239
    edited December 2016

    thanks guys. My main concern was that the effect has to be following the actor but be apply able on multiple different actors without having to constrain each x/y to a table.

    Since Curved paths for particles are not possible.

    I do a spiral and just rotate it via particle behaviour

    PS: Its a "stunned" indicator above the head of enemies.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @BigDave said:
    PS: Its a "stunned" indicator above the head of enemies.

    Could you get the same effect with a frame based animation? Just a few frames might get the effect you need and be very easy on the system.

  • BigDaveBigDave Member Posts: 2,239

    @jamie_c
    Could but to get a smooth looking spin of spiral you need a couple of frames.
    I normally have like 2 frames for my walking animation biggest animations got like 4 frames. Also I would need to paint the effect on all enemy types and get that amount of frames for each.

    So particle or self made particle sounds like the way to go

  • BigDaveBigDave Member Posts: 2,239

    Now I wonder how to calculate the lifetime, rotation speed so it makes exactly one 360 degree before doing the next particle

  • SocksSocks London, UK.Member Posts: 12,822

    @jamie_c said:

    @BigDave said:
    PS: Its a "stunned" indicator above the head of enemies.

    Could you get the same effect with a frame based animation? Just a few frames might get the effect you need and be very easy on the system.

    Agreed, this sounds like it should be a job for a simple frame based animation.

  • SocksSocks London, UK.Member Posts: 12,822

    @Icebox said:
    @Socks The flag demo is really something , didnt know you can do something like that , impressive, although i dont understand a thing with the abs and all the numbers you used :) Thanks for providing it very useful

    abs is short for 'absolute'.

    It returns the 'absolute' value of something, the absolute value basically takes any number and makes it positive.

    abs(22) will give you 22
    abs(-22) will give you 22
    abs(7.54) will give you 7.54
    abs(-800) will give you 800

    etc etc . . .

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @BigDave said:
    ...Also I would need to paint the effect on all enemy types and get that amount of frames for each...

    Depending on your needs, could you create a separate actor as only the effect and spawn it over the top of your stunned actor?

  • BigDaveBigDave Member Posts: 2,239
    edited December 2016

    @jamie_c
    but it would not follow the "parent actor"

    I could have one with short life duration and keep it respawning from the parent actor. But than why not do that via particle.

  • IceboxIcebox Member Posts: 1,485
    edited December 2016

    @Socks said:

    @Icebox said:
    @Socks The flag demo is really something , didnt know you can do something like that , impressive, although i dont understand a thing with the abs and all the numbers you used :) Thanks for providing it very useful

    abs is short for 'absolute'.

    It returns the 'absolute' value of something, the absolute value basically takes any number and makes it positive.

    abs(22) will give you 22
    abs(-22) will give you 22
    abs(7.54) will give you 7.54
    abs(-800) will give you 800

    etc etc . . .

    Yep I know that in general , i try to improve my math everyday and I did , but when it comes to putting it into gamesalad or code in general i just get lost .. so I dont know how you came up with this or the logic behind it, but its impressive.

  • SocksSocks London, UK.Member Posts: 12,822

    @BigDave said:
    @jamie_c
    but it would not follow the "parent actor"

    Why not ?

  • BigDaveBigDave Member Posts: 2,239
    edited December 2016

    Thanks guys
    i am pretty happy with the spiral particle now.
    Image rotated and refreshed every 0.4
    fading out to hide the fact that it doesn't rotate perfect circle

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Looks good, fits the graphic style.

    What I was thinking above was that if the character were stunned and not moving you could just spawn the animation above their head. If they were moving you need to move the animation too. Looks like you've got something good though. :)

  • BigDaveBigDave Member Posts: 2,239
    edited December 2016

    @jamie_c
    thanks buddy I appreciate your help a lot

  • @BigDave said:
    Thanks guys
    i am pretty happy with the spiral particle now.
    Image rotated and refreshed every 0.4
    fading out to hide the fact that it doesn't rotate perfect circle

    haha, whatever you are making looks pretty funny!

  • BigDaveBigDave Member Posts: 2,239
    edited December 2016

    @RossmanBrothersGames said:

    haha, whatever you are making looks pretty funny!

    thanks buddy

  • SocksSocks London, UK.Member Posts: 12,822

    @BigDave said:
    Thanks guys
    i am pretty happy with the spiral particle now.
    Image rotated and refreshed every 0.4
    fading out to hide the fact that it doesn't rotate perfect circle

    Looks great :)

  • BigDaveBigDave Member Posts: 2,239

    @Socks
    thank you!

Sign In or Register to comment.