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
Searching Physics Library for Java Me
-
- Posts: 4
- Joined: Sat Sep 02, 2006 5:11 pm
- Location: Baveria
-
- Posts: 127
- Joined: Sun Aug 13, 2006 4:41 pm
- Location: Cedar Hill, Texas
Re: Searching Physics Library for Java Me
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?
How many objects are you planning to have driven by the physics engine? How complex is the 'world' they'd have to interact with?
-
- Posts: 4
- Joined: Sat Sep 02, 2006 5:11 pm
- Location: Baveria
-
- Posts: 127
- Joined: Sun Aug 13, 2006 4:41 pm
- Location: Cedar Hill, Texas
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.
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.