Bouncing off of walls with 0 gravity problems
Eastbound
Member, BASIC Posts: 1,074
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.
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
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.
Thanks again!