Bouncing Balls go horizontal/vertical

Messing around with a game that has a lot of bouncing balls. Their angle starts out random, never vertical or horizontal. As they bounce around the screen they eventually go horizontal or vertical.

On my wall actors I have movable unchecked and all other physics attributes set to 0. Only the ball has a bounciness of 1.

Any ideas on how to fix this. I know I could do a horizontal/vertical fix, but don't understand how this happens.

Comments

  • RainbrosRainbros Member Posts: 124
    edited January 2016

    You mean if they get close enough to parallel with the walls they just start "sticking" to the walls instead of bouncing? I submitted a bug report for this, but who knows how long until it's fixed. http://bugs.gamesalad.com/show_bug.cgi?id=1513

    If you only have vertical and horizontal walls on the edges of the screen, this is an easy fix. Stop the balls from colliding with walls, and make a rule in the ball actors that says if overlaps with left or right wall, negate linear velocity x. If overlaps with upper or lower walls, negate linear velocity y.

  • crestwoodgamescrestwoodgames Member Posts: 191

    What do you mean negate the linear x or y?

  • zweg25zweg25 Member Posts: 738

    I think he means multiply it by negative 1

  • crestwoodgamescrestwoodgames Member Posts: 191

    I am not using a formula for the bounce. I am letting the physics engine take care of it. As of now I have to put in rules in the actor to correct any Horizontal/Vertical issues, but it does not look good.

    Just not sure why it would do this.

  • RainbrosRainbros Member Posts: 124
    edited January 2016

    @crestwoodgames I know you're using the physics engine, and I'm saying that's where the problem lies. It is a bug. If you use custom bounce rules like I said, the problem should go away.

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

    You can also add a couple rules to the balls that check their velocity X and Y and if they are equal to zero change it to something else when it hits a wall so it bounces off at an angle.

  • crestwoodgamescrestwoodgames Member Posts: 191

    @Rainbros OK, I see what you are saying. I will look into some formulas.

    @jamie_c I will give this a try.

    Thanks for giving some Ideas!

  • crestwoodgamescrestwoodgames Member Posts: 191

    @jamie_c I like this method, but have run into a little issue.

    I have a rule that states if linear velocity Y is between -50 and 50, change to +5. This works great unless I am moving in the negative direction. Same goes for the X axis. I was trying to figure out a formula that could take the direction the balls was moving and nudge it by 5 in the same direction.

    But, I am not a math wiz and cant figure it out. I am sure its probably something simple.
    Have you tried this method before?

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

    Multiply by 1.1 ?

    50 x 1.1 = 55

    -50 x 1.1 = -55

  • crestwoodgamescrestwoodgames Member Posts: 191

    @RThurman oh yeah. I knew that :D thanks! woks like a champ!

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

    Great!

  • barleyesqbarleyesq Member Posts: 72

    I had a similar sticking-to-the-walls problem recently. Turned out I hadn't changed the collision shape to circle on the balls. That fixed that one. Adding a tiny bit of bounce to the walls helped too.

Sign In or Register to comment.