3D Physics with ZgeBullet

Use of external libraries (DLLs) from ZGE.

Moderator: Moderators

StevenM
Posts: 149
Joined: Thu Jan 20, 2011 10:03 am

Post by StevenM »

Been experimenting with this, like it - I will be creating some presets for the visualizer with this. Some things I noticed with the visualizer -

While testing a cube dropping on a plane in FL Studio - I noticed that with each new run my box was getting stacked on an "Imaginary" rigid body - and performance was taking a huge hit too. This wasn't happening when I ran it in ZGE though.

I don't think OnClose gets executed. Putting this onloaded fixed the problem.


zbtDestroyWorld();
zbtDeleteAllShapes();
zbtClearAllHeightLists();


However, seems that crosstalk does exist - changing the bullet settings in one preset will affect another preset. So when using with FL Studio, you should only use one instance of bullet.
StevenM
Posts: 149
Joined: Thu Jan 20, 2011 10:03 am

bullet in zge test

Post by StevenM »

finally making some progress with bullet in zgeViz - here is a test. It's just a box on a pendulum reacting to a midi note, but it's a start - I really enjoy using bullet too. Here is a youtube vid

http://www.youtube.com/watch?v=lpfsGqFfMk0

I'm going to expand this concept to include more objects and I'm goint try to implement projectiles. I' have a pretty good idea about timing it all.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

The latest version of ZGEBullet library comes with some improvements in API; see the attached zgebullet.txt. Another step further is support for Android.

Remark: the latest testing application is not compatible with this library! I'll prepare a new version of testing application; hopefully. Currently, I'm personally testing the library on a game Toyland Shooter which is still in development.
Attachments
libZGEBullet.zip
libZGEBullet.so for Android (android-8, armeabi)
(421.84 KiB) Downloaded 800 times
ZGEBullet.zip
DLL for Windows
(265.35 KiB) Downloaded 824 times
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

I'm pleased to announce that ZGEBullet has been published on Google code - see http://code.google.com/p/zgebullet/.

Since now, all new releases of the library, "official" demos, documentation (will come later), related material, etc. can be downloaded from the Google code's project page. Of course, I'll keep you informed also via this forum/topic.

If you are interested in seeing the code, compiling it by yourself, improving it, finding bugs, putting any comments to the issue tracker, etc., please, visit the project page. You are also welcome to become a contributor.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Thanks for publishing the source Rado1. It looks efficient enough. Good choice of using "ref" parameters to set position X,Y,Z etc in one call. I'm sure it can be slightly optimized further but it is not worth the effort because the bottleneck will still be inside Bullet physics computations.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

not sure how to use the new version,. with the ref stuff?

CurrentModel.Position.X = zbtGetPositionX(rbId);
CurrentModel.Position.Y = zbtGetPositionY(rbId);
CurrentModel.Position.Z = zbtGetPositionZ(rbId);

becomes ??

zbtGetPosition(int collisionObjectId, ref float x, ref float y, ref float z)

CurrentModel.Position= ?
iterationGAMES.com
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi jph,

Should become ..

Code: Select all

zbtGetPosition(id, CurrentModel.Position.X, CurrentModel.Position.Y, CurrentModel.Position.Z);
Haven't tried it myself though.

K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

You are right Kjell. This is usual OnUpdate code for dynamic objects:

Code: Select all

// update position and rotation
zbtGetPosition(RigidBodyId, CurrentModel.Position.X, CurrentModel.Position.Y, CurrentModel.Position.Z);
zbtGetRotation(RigidBodyId, CurrentModel.Rotation.X, CurrentModel.Rotation.Y, CurrentModel.Rotation.Z);
This demo project shows how to use updated API.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Cool,. thanks Kj, works as you say.

Very nifty Rado,. I am doing some physics tests for an idea I have for a little game,. just wanted to use the latest ver. of this.., will post if anything interesting develops.
iterationGAMES.com
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

thanks for that demo project Rado, that is what I needed to get going,.

is zbtCreateHeightfieldTerrainShape still supported? how to feed the terrain data to this now?

zbtCreateHeightList(); and related functions are gone. I am only look to use a static terrain,. if this is still possible. thanks again.
iterationGAMES.com
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Hi Jph, all,
jph_wacheski wrote:is zbtCreateHeightfieldTerrainShape still supported? how to feed the terrain data to this now?
yes, zbtCreateHeightfieldTerrainShape is still supported, and thanks to the xptr parameter for heightfield data, it provides even better performance for dynamic heightmaps.

BTW today I added more parameters to zbtCreateHeightfieldTerrainShape to have better control over its properties. Up to now, heightmap was always subdivided to diamonds; which is better for smooth (hi-poly) meshes, but simple triangulation is better for low-poly terrains based on larger triangles. So I added a parameter to enable/disable diamond division. Another added parameter is heightScale, which was always 0 (unused?) up to now.

The updated version of ZGEBullet library can be found here. A new demo project, used to demonstrate dynamic heightfield terrains, was also added. Have a fun!

Rado1.

PS. Ville can you please add a new version of zgebullet.txt to ZGE distribution, thanks.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Works fine here. Very nice.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

As you probably noticed here, ZGEBullet was compiled also for 64-bit Windows. It has become a part of "official distribution" and the latest version can always be downloaded from http://code.google.com/p/zgebullet/downloads/list.
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

Looks pretty good :)
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

ZgeBullet library has been updated to version 1.2; here is the change list:

Added:
- Support for raycast vehicle, a simple car simulation.
- Added demo #3 for raycast vehicle (used car control is little bit weird but it's almost the same on Windows with mouse and on Android with touches).

Changed:
- Updated to Bullet 2.82 (rev.2704) - latest stable version.
- ZGEBullet renamed to ZgeBullet.
- Removed boolean and rotation constants from ZGE external library.
- Demos updated to the latest changes and ZGE language updates.

For details see the ZgeBullet page at Google Code. Download demos and precompiled library for Windows and Android from the download page.

Note: The raycast vehicle demo uses Bullet's height field, which does not provide very reliable collision detection and sometimes objects can pass through. This is a known issue of Bullet library.
Attachments
screenshot of raycast vehicle demo
screenshot of raycast vehicle demo
scr.jpg (87.88 KiB) Viewed 34214 times
Post Reply