follow the bouncing balls...

harrioharrio Member Posts: 234
edited November -1 in Working with GS (Mac)
what's cookin,

hey fellow chefs, here is a template solution to the illusive 'bouncing balls on flat planes' problem. once again, the headchefs have come through.

http://gamesalad.com/game/play/35891

i know this was addressed in several different threads but never sufficiently solved. hope this helps everyone out.

noodles...

Comments

  • harrioharrio Member Posts: 234
    what's cookin,

    it's an easy add tshirt. just add a collide behavior for the 'ball' actor. done.

    i made the demo this way so that people could watch the balls over time and see that they don't get stuck horizontally or vertically like all the other ball demos do eventually.

    noodles...
  • harrioharrio Member Posts: 234
    what's cookin,

    my bad, that's what i meant. i already tested it myself with 'ball collision' also and they maintain speed throughout. but i didn't tell you that, i just assumed it in my head and told you...'sure, just add the behavior...' when i should have said, 'i've already tested that. it works fine. so just add the behavior and your g2g.'

    my apologies,

    noodles...
  • harrioharrio Member Posts: 234
    what's cookin,

    hey tshirtbooth. my bad once again. i ran the demo again and it does slow down with 'ball collision' added in.

    but i fixed that by using the code from the 'infinite bouncing balls w/constant speed' template demo. so it runs as desired for you now.

    http://gamesalad.com/game/play/36030

    my apologies for not checking it out thoroughly the first time. i've left both demos up so people can get exactly what they want.

    noodles...
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Oh that's awesome!
    I was going to add that to my Magnitude demo, but I couldn't figure it out.
    Great!
  • rebumprebump Member Posts: 1,058
    So what was the underlying problem being solved by this demo (i.e. the problem you refer to that you say was mentioned in several other threads)?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    If you simply add a collide behavior in the ball actor so it collides with the other balls, when they do collide, they slow down considerably. I couldn't figure out how to keep them at a constant speed.

    I'll add that in to my Magnitude demo when I get the chance.
  • rebumprebump Member Posts: 1,058
    Ahh. Good to know. Thanks all.
  • harrioharrio Member Posts: 234
    what's cookin,

    there was also a subtle problem of ball actors which when set to collide with perpendicular walls would eventually settle into a fixed pattern either horizontally back in forth or vertically up and down.

    so instead of relying on the 'physics' collision i aimed to fake the 'angle of reflection' at the point of collision. i apologize for the math-fanity to qsheep...lol. my equations got me almost there but i was getting some of the quadrant math wrong. namely when to be a positive or negative value. that's when math-deity jonathan samn swooped in and simplified my math to the point of making me feel stupid...again.

    he just inverted the value of Motion.linearVelocity(x/y) at the point of collision depending on the wall type - horizontal/vertical and voila'...instant fake angle of reflection.

    i'm glad it can help people. wish me luck in scrambling to get my game submitted to 'macworld' in time.

    noodles...
  • rebumprebump Member Posts: 1,058
    Coolio, Mr. Harrio!
Sign In or Register to comment.