Moving actors in a circle and/or a predetermined path

13»

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited August 2017

    @monkeyboy simian said:
    wow @RThurman and @Hopscotch – That looks like what I'm aiming for! I just did a bit of a google on SuperShapes and my brain melted. I liked the look of that demo video you put up. Is there a way that someone who's mathematically challenged could apply this?

    Yep, the formula is quite easy. Finding the ideal parameters is not. :)

    The above project would need some stuff ripped out and cleaned up to be of any help.

    But here is the gist of it for now:

    Shapes are defined by 6 parameters:

    m (number of sides)
    n1, n2, n3 (just mess around :) )
    a, b (noobs keep it at value 1)
    

    For each ball:

    phi = angle_offset + deltatime
    t1 = pow(abs(cos(m * phi/4)/a), n2)
    t2 = pow(abs(sin(m * phi/4)/b), n3)
    radius = radiusoffset + radiusvariation * pow(t1 + t2, 1/n1)
    X = Xoffset + radius * cos(phi)
    Y = Yoffset + radius * sin(phi)
    

    The angle_offset is the starting angle of each ball.
    deltatime is some change over time to make it move, e.g. using game.time.
    Xoffset and Yoffset are the center of your object.

    I have a feeling that your implementation will very much depend on the game mechanics you are going for.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @Hopscotch – Thanks forth breakdown of what's going on there. I just wish I had a clue how to use it. I know, I'm an intellectual midget here. I tried looking for those things in the expression editor and couldn't find them. "phi", "t1", "t2", "m" "n1", "n2", "n3", "a", "b".. I have no idea how to conjure these things up. Inside my skull there is a very small brain that really is hurting. Could you please help me to understand how to implement this?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,866

    @Hopscotch said:
    I wish I had your fluency in higher math!

    Har! Its all a smokescreen. I'm still counting on my fingers. (But I do know how to read Wikipedia!)

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,866

    @monkeyboy simian -- here is an example of using a version of the superfoumula. You can play with the numbers and get different shapes. (I included some groups of different shapes you can turn on and off.)

  • Village IdiotVillage Idiot Member, PRO Posts: 486
    edited August 2017

    Thanks @RThurman – I'll definitely dig into that demo. I still don't understand how you know what to stick into the expression editor to make theses things happen. Is pow this: The power of a number says how many times to use the number in a multiplication. It is written as a small number to the right and above the base number. In this example: 82 = 8 × 8 = 64. (Another name for power is index or exponent) Exponents.
    Definition of Power - Math is Fun
    https://www.mathsisfun.com/definitions/power.html

    And everything else in there..

    And then there's this theta thing.. How can you know how to throw these things in there and control the outcome so well?

    Is it just something I should give up trying to understand? Because I've spent many hours trying to comprehend this stuff and it makes no sense to me.. sigh (again). I feel like I've opened a can of worms here.

    The disheartening thing for me is that I'd really like to understand this stuff and be GS ninjas like you guys, but it seems like I just don't have enough brain cells for it. I didn't do any of this stuff in school – and school was a long time ago, in a galaxy far far away..

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,866

    You are welcome @monkeyboy simian.

    Yes on the definition of the "pow()" function.

    There is really nothing magical about plugging formulas into the expression editor. You just gotta have confidence that GameSalad will handle it. In all honesty, I don't understand the superformula either. But then I don't really understand how magnets work either! (I just see the results.)

    I just followed this tutorial:

    And then I plugged in the formula into GameSalad and did a little tweaking. Honest!

    Theta is just an incrementer to change the angle. You can use self.time instead if you want. (Or any other way of moving theta (the angle) forward or backward.)

  • ToqueToque Member Posts: 1,185

    Great video. I almost understood it but at least I get the concept now.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @RThurman – Brain melt.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,866

    @monkeyboy simian said:
    @RThurman – Brain melt.

    Yup -- the equation is beyond me as well. But its easy enough to just plug it in where needed. Brains far superior to ours have already done the heavy work. But we can make practical use of it.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @RThurman – It might be beyond you, but it's in another universe to me. I have no idea what any of that stuff means. I don't even know how you apply any of it to the expression editor.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,866

    @monkeyboy simian -- the challenge is all psychological. By that I mean that your worried about not knowing what it means -- and therefore cant use it. But you and I use all sorts of math we don't understand. We just ignore our ignorance!

    For example, most people can handle addition/subtraction. But thats it. In fact, its just at the top edge of common understanding. Almost nobody understands how multiplication/subtraction works! (Including me.) For example (2x3) is not (2+2+2) -- multiplication is not adding a number together so many times. But people think they do understand. And so they use it anyhow.

    Calculus/trig is just as hard to understand as multiplication. But most of us don't really understand it either. (Including me.) We just plug in the calc/trig equations and it works every time.

    It is the same with the superfoumula. We can use it reliably just like any other math equation -- even if we don't understand it. We just plug in the numbers into the formula and let the computer do its thing!

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @RThurman Is it like "the force"? If it is, it's not so strong with this one..

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,866

    Well.... OK then!

    But meanwhile, you don't need to even open up the equation in the expression editor. All you need to do is modify the attributes to get it to make different shapes.

    I included in the demo several shapes. Try turning off (and on) the different groups, you can get different shapes.

    You can also experiment with different shapes just by modifying the attributes. Its fun -- like a spirograph toy. And you never have to look at the equation.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    Thanks RThurman – I'll explore what I can do.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    Thanks @RThurman – I'll explore what I can do.

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2017

    @RThurman – It might be beyond you, but it's in another universe to me. I have no idea what any of that stuff means. I don't even know how you apply any of it to the expression editor.

    If you are typing in English on a keyboard your brain is already thousands of times more skilled than what is required for some of this stuff, you are simply not familiar with it, I think if you were to learn some GS trigonometry you might actually be quite disappointed, you will likely ended up thinking "Oh, so that was all it was, just X and Y coordinates, I thought there was some witchcraft involved".

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    Hi @Socks.. are you sure Harry Potter isn't lurking around somewhere?

Sign In or Register to comment.