Hello,
I am very new programmer in Flash and especialy in Box2D.
I have a small problem which drives me crazy.
Imagine that I want to make an Arcanoid clone to practice my skills. I thought of having 3 walls (all static), some bricks (also static), a racket (also static - I might move the position by hand) and a Ball (Dynamic Body). I also thought of having 0 gravity, so that gravity don't pull the ball down (it must seem like it travels into space).
For my very first step, I have done the following:
1) Created a small polygon shape (box) for my racket in which I gave the following properties:
a) friction=0
b) restitution=1
c) density=0
d) static body
and 2) Created a small circle shape (for my ball) a small distance over my racket:
a) friction=0
b) restitution=1
c) density=1
d) dynamic body
Finally, I thought of seeing the results in DebugDraw. Of course, by having a gravity vector of 0 in the world and by not applying any force to the ball, you will never see the ball bouncing over the racket. So, I changed the gravity of the world to 0.0, 3.0.
Dadaaaaaaa... The ball bounces over the racket continuesly.
My problem is the following:
While the ball bounces over the racket, it gains continuesly some height. Why is it happening? As far as I know, by having a restitution value of 1 to both objects, it will make the ball return to the opposite direction with the same force. I would understand it if my ball was loosing height on each bounce, since the gravity vector continuesly pulls it down, but going up? It is driving my crazy...
Thank you very much for your help.
Efthymios Kalyviotis
Computer Programmer
I am very new programmer in Flash and especialy in Box2D.
I have a small problem which drives me crazy.
Imagine that I want to make an Arcanoid clone to practice my skills. I thought of having 3 walls (all static), some bricks (also static), a racket (also static - I might move the position by hand) and a Ball (Dynamic Body). I also thought of having 0 gravity, so that gravity don't pull the ball down (it must seem like it travels into space).
For my very first step, I have done the following:
1) Created a small polygon shape (box) for my racket in which I gave the following properties:
a) friction=0
b) restitution=1
c) density=0
d) static body
and 2) Created a small circle shape (for my ball) a small distance over my racket:
a) friction=0
b) restitution=1
c) density=1
d) dynamic body
Finally, I thought of seeing the results in DebugDraw. Of course, by having a gravity vector of 0 in the world and by not applying any force to the ball, you will never see the ball bouncing over the racket. So, I changed the gravity of the world to 0.0, 3.0.
Dadaaaaaaa... The ball bounces over the racket continuesly.
My problem is the following:
While the ball bounces over the racket, it gains continuesly some height. Why is it happening? As far as I know, by having a restitution value of 1 to both objects, it will make the ball return to the opposite direction with the same force. I would understand it if my ball was loosing height on each bounce, since the gravity vector continuesly pulls it down, but going up? It is driving my crazy...
Thank you very much for your help.
Efthymios Kalyviotis
Computer Programmer