http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bouncing balls. WAS Re: GP: Flipping a point across a line: The answer



On Wed 08 Sep, Kevin Shea wrote:
> Can I ask what sort of thing you're actually doing and for what reason
> are you doing it?
A game/graphics engine because I want to.  In a small group.

> Some more information would be useful to give everyone a chance to help
Ok...

Right now, all I want to do is have a Java applet which shows two or
more balls, of indeterminate size (guarenteed >0), mostly moving, but
sometimes not, and have them bounce off each other.  No weight, mass or
density or anything has to be known - just a guarentee that the the place
they're at after the collision is relative to the angle they hit at when
travelling towards each other.

Btw: Could I ask Don to re-post his answer to this problem?

At the moment all I know is...

	ballA.x_location		ballA.y_location
	ballB.x_location		ballB.y_location

	ballA.x_direction		ballA.y_direction
	ballB.x_direction		ballB.y_direction

The method I'm using to define the direction and speed of the balls is
a signed integer for the X and Y directions.  Eg: if a ball is travelling
at XD = +10 and YD = -10 it is going right at a horizontal speed of 10
units per frame and down at a vertical speed of 10 units per frame.

(Incidentally the units are pixels, but they don't necessarily have to be.)

I plan to convert the final 2D code into 3D, so that we can use our engine
to create (eg:) a Quake-style game (that's a regular expression nowadays!)
involving `footballs` (probably made of steel! :).  The balls could be
kicked and maybe even shot at and bounce off walls etc. and EACH OTHER!!!

So, yes, this is a game question, although it involves geometry, because
games require good geometry (which I don't really have).  My technique is
to get something which works, refine it and speed it up then turn it to
some form of 2D or 3D version which we can use.  Speed is the issue for us.

If u take a look at the 3D elstic sheet on my web page graphics section
you'll be able to have a go on an example - it evolved from a 2D program.

Sorry this was a bit long...


Regards,

Matt. W.
-- 
      ***   eudoxus@freeuk.com   ***
***   http://www.eudoxus.freeuk.com/   ***
mwebster@apsoft.co.uk   http://members.xoom.com/eudoxusM/

=================================================================
To SUBSCRIBE or UNSUBSCRIBE please visit
http://gameprogrammer.com/mailinglist.html