Advertisement

10.06.2008 at 02:09PM PDT, ID: 23791986 | Points: 250
[x]
Attachment Details

Created a parabola, now I need it to bounce. Uses basic projectile physics.

Tags:

Microsoft, C#, 2008, Physics and Math, Projectile Parabola Bounce Collision Math Physics

I've created a very basic projectile object in C#, I give it an angle and velocity... and it shoots it. I now need to figure out how to make it bounce when it hits the ground (and the wall, but that can be later). Below is the code from my update method of the projectile that is basically iterating through the algorithm to generate the new x,y coords.

I also don't really know where to check for the bounce, I imagine i do it in the front end of the form/canvas that has created the projectile instance. I'm having a hard time with the logic here. help, please!
1:
2:
3:
4:
5:
6:
7:
8:
9:
dt = .3f;
            gravity = 9.8f;
            this.VelocityX = (float)(this.initialVelocity * (float)Math.Cos(Angle) * t);
            this.VelocityY = (float)(this.initialVelocity * (float)Math.Sin(Angle) * t - gravity * t * t / 2);
 
            this.x = this.VelocityX + this.InitialX;
            this.y = -this.VelocityY + this.InitialY;
            
            t += dt;
Top Expert: ozo
Expert Since: 08/20/1997
Accepted Solutions: 9624
ozo has been an Expert for 11 years 4 months, during which he has posted 41256 comments and answered 9624 questions. ozo is just one of 64 experts in the Physics & Artificial Intelligence in Game Programming Zone.
 
 
 
 
20081119-EE-VQP-47 / EE_QW_2_20070628