Searching Physics Library for Java Me

Please don't post Bullet support questions here, use the above forums instead.
gkvoelkl
Posts: 4
Joined: Sat Sep 02, 2006 5:11 pm
Location: Baveria

Searching Physics Library for Java Me

Post by gkvoelkl »

Hello,

I am writing a game for mobile phones with Java Me (J2Me).

Does anyone know a physics library that I can use?

Thanks.

Best Regards

Gerhard
User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Re: Searching Physics Library for Java Me

Post by SteveBaker »

I have my doubts that a mobile phone would have enough CPU horsepower to run a pure physics solution...at least not if there are more than a small number of physically active objects or much scenery for them to collide against. I presume you'd need a pure Java library too - that makes matters even worse because Java code is slower than C/C++.

How many objects are you planning to have driven by the physics engine? How complex is the 'world' they'd have to interact with?
gkvoelkl
Posts: 4
Joined: Sat Sep 02, 2006 5:11 pm
Location: Baveria

Post by gkvoelkl »

Hi!

At the moment I am planning to do two different games:

Game 1:
like Marble Madness: One sprehre and some cubes as obstacles

Game 2:
Racing Game: One player car and three oponent cars and a terrrain.

Best Regards

Gerhard
User avatar
SteveBaker
Posts: 127
Joined: Sun Aug 13, 2006 4:41 pm
Location: Cedar Hill, Texas

Post by SteveBaker »

For game 1, you can do really simple stuff yourself - the only force is gravity and there is only one moving object (essentially) - so do collision detection yourself (a sphere is the simplest object of all to do collisions with) - when you detect that you've collided and penetrated, it's trivial math to back the object back up along it's path until it's just touching - reflect the motion vector in surface normal of the surface you collided with and carry on with life.

If you get multiple collisions within one frame - calculate when in time you hit each one, deal with the first one - then rerun the physics when you've figured out what to do about it.

For game 2...you have a problem.