Bouncing off of walls with 0 gravity problems

EastboundEastbound Member, BASIC Posts: 1,074
edited November -1 in Working with GS (Mac)
I have a game screen with a bunch of balls that move in random directions and bounce around. The game has 0 gravity, it's just overhead.

The problem is, that when the angle that a ball approaches a wall at isn't big enough (say, 10 degrees), it won't bounce off the wall. It will just start to slide along the wall. After 30 seconds or so, a lot of the balls are just sliding on the wall.

On the walls and balls I have restitution set at 1, friction at 0, and density at 1.

I'm thinking I'll need a math work around to determine the direction the balls should bounce, but I don't know what that would be.

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    In my magnitude demo, the balls always bounce off the walls (and each other) at a constant speed. (which was not working properly without this math fix)

    Before, they would slow down if they hit anything.

    The math is a little heavy, so definitely test on a device to see how many balls you can have going at once.
  • EastboundEastbound Member, BASIC Posts: 1,074
    Ah thanks a lot. Simply making a vertical and horizontal wall inverting the linear velocities fixed it for me.

    Thanks again!
Sign In or Register to comment.