B4A Library ABPhysicsEngine library v0.10

A physics engine for Basic4Android.

[VERSION 1.1] minor update with some bugfixes and speed optimalisations

Please give credit to me if you use this library in your software as it took a lot of research and effort to get the physics right, but still very simple to use.

Features:
- collision detection (Circle-Circle, Rect-Rect, Circle-Rect and Rect-Circle) between groups and within groups
- particles with elasticity, friction, traction, sprite animation, etc...
- Joints with stiffness that connects particles
- groups of particles and joints
- self-buildable forces (like gravity, push, ...) on the engine and individual particles
- vector functions
- ...

*** This is beta and there is a possibility some functions will change in the future***

A demo project with some of the functionalities is added. If you have trouble with the physics, I suggest you google the subject, as I'm not going to explain this stuff. There is a lot of fun in understanding how things work and you're never to old to learn! ;)

Alwaysbusy
 

Attachments

  • ABPhysicsEngine.zip
    315.7 KB · Views: 1,732
Last edited:

PaulR

Active Member
Licensed User
Longtime User
One question... how would I fake a global friction value for wind or surface resistance?
 

DannyRyan

Member
Licensed User
Longtime User
Particle Touch?

Hi,

Does anyone know if it is possible to do a ABParticle Touch event?

For example if i click on a particle, can i code an event to;
1. move the particle with the users finger?
2. Change elements of the particle - ie change the width of the particle?

Thanks
 

Gunther

Active Member
Licensed User
Longtime User
Hi,

does this Engine support also rotations of round particles?
Currently I only found that one can set the initial degree (rotation), but if you change from one to another value the particle is jumping to the new degree without swinging to the new value.

Does someone have an idea?
 

CodeDancer

Member
Licensed User
Longtime User
Fitting Demo to screen

Hi A.B.,

I had even more problems than Widget and used GetDeviceLayoutValues to resize the panel to match my tablet (600X800).
The layout file that you load is for a width of 320 and height of 533.

I noticed that you had incorporated Widget's revision into your source code.
I had to fudge that a little. The scale works better at .70 than .75 as calculated.

Anyhow, now that I have the demo fitting on the screen, I am eager to start putting your library through it's paces.

I will see if I can come up with something to dazzle myself.

By the way, I don't understand B4A's member classification. I am course am a Newbie, which is fine. Makes me feel young. On the other hand , based on your contributions, you should be an Expert Emeritus. Seems like the game is rigged.
 
Last edited:

Thilo111

New Member
Licensed User
Longtime User
Conservation of Energy

I reduced the example down to only the Rect and one single not fixed wheel. I set everything to fully elastic. Now the wheel should bounce at the rect and come back to the same height. But it does not, it looses energy. After 5 bounces it just lays on the ground.

Tried different setting, but always the same behavior.

Regards, Thilo
 

RichyK68

Active Member
Licensed User
Longtime User
Is there an update for this library? I'm using version 0.11.

It works really well except that I've setup four rectangles (one each side of the screen to form a container) and sometimes the particles on the inside of the container penetrate the walls and disappear into oblivion.

Thanks,

Richard
 
Top