irrBullet 0.1.8 - Bullet physics wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

hybrid wrote: If you don't use 'using namespace irr' somewhere, you cannot use core::vector3df but have to use irr::core::vector3df
But maybe some lib has a malformed header? At least Irtrlicht shouldn't have any using in the headers, besides those required for legacy compliance (might already be removed, though).
Hm, maybe irrBP is using the 'using namespace' keyword, I should go talk to Zurzaza.
Working on game: Marrbles (Currently stopped).
RobinvK
Posts: 12
Joined: Thu Mar 10, 2011 1:22 pm

Post by RobinvK »

I'm trying to set up irrBullet in Visual C++ Express but I can't seem to get it to work. I've had trouble with setting up things like this before in visual C++, but for irrLicht I managed to get things working in a different way:
I copied the Irrlicht.dll file to my system 32 folder.
I copied Irrlicht.exp and Irrlicht.lib to the visual studio folder: C:\Program Files\Microsoft Visual Studio 10.0\VC\lib
I copied all the header files to C:\Program Files\Microsoft Visual Studio 10.0\VC\include\irrLicht

All I had to do then was to put
#include <irrlicht/irrlicht.h>
instead of
#include <irrlicht.h>

and I needed to put a pragma comment in my main.cpp file
#pragma comment(lib, "Irrlicht.lib")


That is how I got irrlicht working. But this method doesn't seem to work for irrBullet.
What I did:
no irrBullet.dll file so that wasn't necessary.
I copied the irrBullet.lib file from irrBullet-0.1.71\lib\win32_visualstudio\2010\Release to the visual studio lib folder (no .exp file)
I copied everything in the irrBullet-0.1.71\source folder to C:\Program Files\Microsoft Visual Studio 10.0\VC\include\irrBullet
I also copied the 'framework' folder of the examples to there

I made a new project and made a main.cpp helloworldexample.cpp and helloworldexample.h. Then I copied the code from the example files to my project. I then corrected some of the links (#include <irrBullet/irrBullet.h> instead of #include <irrBullet.h>)
And I added #pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib, "irrBullet.lib") to the main function. I must have done something completely wrong because the errors just kept piling up:
Image



Then I tried to do it like it said in the ReadMe.doc file. But I don't understand steps 2.1 and 2.3
2.1 says I should include the following to the search directories of my project:
%irrBullet%/source
%irrBullet%/source/bheaders
%irrBullet%/source/bheaders/Bullet

Where can I find these search directories? I followed the steps in the following blog post:
http://blogs.msdn.com/b/vsproject/archi ... ories.aspx
I see a lot of directories, but not a search directory. I assume I should put it in one of the other directories listed here, but which one? I'm afraid of just trying things out because I might mess up Visual studio.

step 2.3 says:
add these files to your linker (available in the libs/ folder):
libirrBullet.a, libbulletdynamics.a, libbulletsoftbody.a
libGIMPACTUtils.a (if you use GImpact),
liblinearmath.a, libbulletcollision.a
all I found in the irrBullet-0.1.71\lib\win32_visualstudio\2010\Release folder was irrBullet.lib
However in the irrBullet-0.1.71\lib\win32_gcc folder I found all the *.a files. So which should I include? and how do I do that?

Sorry, this is more a Visual studio question than an irrBullet question, but any help is very much appreciated!
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

I copied the Irrlicht.dll file to my system 32 folder.
Don't do it, ever. When you'll rebuild irrlicht.dll and forget to replace it you may get into big troubles finding where your problem is.
I copied Irrlicht.exp and Irrlicht.lib to the visual studio folder: C:\Program Files\Microsoft Visual Studio 10.0\VC\lib
I copied all the header files to C:\Program Files\Microsoft Visual Studio 10.0\VC\include\irrLicht
Seriously, why on earth are you copying everything?
Theres an option to link libraries, which is way more convenient than copying it over and over again when you rebuild it.

all I found in the irrBullet-0.1.71\lib\win32_visualstudio\2010\Release folder was irrBullet.lib
However in the irrBullet-0.1.71\lib\win32_gcc folder I found all the *.a files. So which should I include? and how do I do that?
Erm, I'm sure you're missing original bullet library which you must have in order to get irrbullet working, and you should include .lib files since you're using msvc.

I don't remember msvc stuff, so I can't help you with includes, and search paths, but these all should be somewhere in options I guess.
Working on game: Marrbles (Currently stopped).
RobinvK
Posts: 12
Joined: Thu Mar 10, 2011 1:22 pm

Post by RobinvK »

Oh, didn't know that! :shock: This is how someone at cplusplus.com told me to do it.
I'll first try to set up irrlicht by linking to the files then.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

RobinvK wrote:Oh, didn't know that! :shock: This is how someone at cplusplus.com told me to do it.
I'll first try to set up irrlicht by linking to the files then.
And when you need just copy irrlicht.dll where your executable is, tough when you run it from msvc it could fail, because some IDE's set up different working directories, so you should check it out and copy your dll too when you want it to run from msvc. But I don't know if msvc does that.
Working on game: Marrbles (Currently stopped).
RobinvK
Posts: 12
Joined: Thu Mar 10, 2011 1:22 pm

Post by RobinvK »

EDIT: problems resolved! Thanks to Cobra & the irrlicht chat :)
I'll recap how it was solved in case someone else might encounter the same problems in the future:


This is how I got the Hello World example to work:
My first mistake was not installing Bullet itself (really stupid :x ) So do that first. I recommend you follow these steps:
First get the Hello World example of Bullet to work.
Then get this to work:http://irrlicht.sourceforge.net/phpBB2/ ... 918#223918
Now you can try to get the Hello World example of irrBullet to work.


Then I made some mistakes by executing the steps in the readme file of irrBullet.
The readme file says:
2.1. Add these search directories to your project:
%irrBullet%/source
%irrBullet%/source/bheaders
%irrBullet%/source/bheaders/Bullet
In visual studio 2010 this is done by going to the property pages. Then expanding the C/C++ option in the menu and clicking the General option in the menu. The first parameter is Additional Include Directories. Click on the empty field and on the arrow that appears. Then click <edit>
Now you have the 3 folders mentioned above. They are found in the irrBullet folder.
That was pretty straightforward, but you need to do the exact same thing again, but now for the Release configuration. on the main screen of the project you see a green 'play' arrow you can click on to start debugging. Next to it is the word 'Debug', change that to Release and redo the above.

Step 2.2 was already done in the hello world example code

Last step:

Code: Select all

2.3. add these files to your linker (available in the libs/ folder):
	libirrBullet.a, libbulletdynamics.a, libbulletsoftbody.a
	libGIMPACTUtils.a (if you use GImpact),
	liblinearmath.a, libbulletcollision.a

	Make sure the linker files are in that order for irrBullet
	or your project will not compile.
These files can be found in the irrBullet-0.1.71\lib\win32_visualstudio\2008 folder
Include them by going to the property pages again, then under C/C++ go to Linker/Input you must include the lib files next to the Additional Dependencies by adding them like this: BulletSoftBody.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;
You probably have to do this for both debug and release mode, but I did this entire step differently. I put the following in the main.cpp function of my project:

Code: Select all

#pragma comment(lib, "irrBullet.lib")
#pragma comment(lib, "BulletDynamics.lib")
#pragma comment(lib, "BulletSoftBody.lib")
#pragma comment(lib, "GIMPACTUtils.lib")
#pragma comment(lib, "BulletCollision.lib")
#pragma comment(lib, "LinearMath.lib")
#pragma comment(lib, "Irrlicht.lib")
And thats it, it works. I still have 41 warnings, but no errors and it runs perfectly fine :)




I got the Hello World example of Bullet working without a problem now. Only thing I added to it was this:

Code: Select all

 #pragma comment(lib, "irrBullet.lib")
#pragma comment(lib, "BulletDynamics.lib")
#pragma comment(lib, "BulletSoftBody.lib")
#pragma comment(lib, "GIMPACTUtils.lib")
#pragma comment(lib, "BulletCollision.lib")
#pragma comment(lib, "LinearMath.lib")
(This is the same as adding the files to the linker, right?)

I don't seem to be able to get the irrBullet Hello world example to work though. I created a new project, made a main.cpp helloworldexample.cpp and helloworldexample.h file and copied the code from the examples to it. I also copied the exampleframework folder to my project folder and I added the following to the main.cpp file:

Code: Select all

#pragma comment(lib, "irrBullet.lib")
#pragma comment(lib, "BulletDynamics.lib")
#pragma comment(lib, "BulletSoftBody.lib")
#pragma comment(lib, "GIMPACTUtils.lib")
#pragma comment(lib, "BulletCollision.lib")
#pragma comment(lib, "LinearMath.lib")
#pragma comment(lib, "Irrlicht.lib")
Now I get 8 warnings and 19 errors:
Image
full size image:
http://postimage.org/image/33p3hxrb8/full/

I have no idea what these errors mean, but it's probably because I did something wrong in step 2.1:
2.1. Add these search directories to your project:
%irrBullet%/source
%irrBullet%/source/bheaders
%irrBullet%/source/bheaders/Bullet
How should I do this step in visual studio 2010?
[/size]
mataanjin
Posts: 19
Joined: Tue May 25, 2010 3:07 am

Post by mataanjin »

@RobinvK
maybe you need to use release instead of debug.
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

mataanjin wrote:@RobinvK
maybe you need to use release instead of debug.
We already resolved his problem. :)
Josiah Hartzell
Image
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Post by RdR »

Somehow the precompiled win32 gcc version did'nt work for me in Eclipse.
There where still some absolute paths in them ? :shock:

So I compiled Bullet 2.78 and irrBullet 0.1.71 for gcc (MinGW)

If anyone needs them here it is: http://www.megaupload.com/?d=DM1DSV7P

Edit:
And also Linux precompiled Bullet and irrBullet (GCC): http://www.megaupload.com/?d=X6DM3ITU

Might be usefull to anyone.
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Strange things happen when I modify hello world example, add collision from collision example and change the level from ground into a room static trimesh. First there's tunelling(cubes go thru some places, but won't like 3 pixels to the right or left). Second, if I check the shoot cube collision with the level it collides even inside of it, while my player controller doesn't(it's ok). This is strange, since I am shooting cubes and seeing them delete instantly(and yes, I've tried flying up the level and shoot the cube down, it deletes even hitting so-looking empty space in the room, seems like it checks bounding box not tris, but for player it's tris, and for no collision check it's also tris for the cubes and spheres... :D).. Is there any step I have missed? :?
mrdoubleb
Posts: 9
Joined: Tue Apr 12, 2011 1:10 pm

Post by mrdoubleb »

We have included Irrbullet in our project to do the physics for our vehicles / objects.

I added wheels to the vehicle and can drive it around but its really jumpy / bumpy even when standing still.

Can somebody tell me how to tweak the wheel settings of irrbullet to have my vehicles drive more realistic??
silver.slade
Posts: 17
Joined: Fri Jan 29, 2010 8:54 am
Contact:

irrbullet video on win32 system and Irrlicht 1.7.2

Post by silver.slade »

Hi there!

Cobra, you made an eccellent work with irrbullet !!!

In these days I've compiled some examples using your irrbullet but found some problems to fit it in a win32 system and MinGW.

I had to recompile bullet 2.78 and then link irrbullet....but finally I've managed to see some....results.

Here they are:
http://www.youtube.com/watch?v=ScniyBdEUlE

The source loads an irr scene file, applies collisions and phisics and manage to shoot balls and boxes (what a fantasy....).

If you like I can provide:
1) some instructions about use irrbullet on win32 + MinGW
2) the source if you want to include it in your "bin" distribution (if you like to).


Long live and prosper
silver.slade

:D
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

Murloc992:
Box shapes tunnel quite easily because there is less geometry to measure penetration. You can experiment with the CCD values to minimize tunneling (IRigidBody::setCCDValues()).

As for the collision callback, you have to check the length of the collisions. See the irrBullet FAQ for more information. If you don't check the length, then it is the penetration of the object's AABB.


mrdoubleb:
It seems that you need to change the scale of your world. It's probably too small or too large for accurate simulation. Also, make sure your vehicle isn't on a massive surface. Try subdividing the level geometry a few times to see if it helps.


silver.slide:
Thank you. That is an excellent example of irrBullet's liquid emulator! I already did an example to read from a .irr file (just because people often ask how to do it), and there's already a water example. Moreover, I'd have to include the Realistic Water Scene Node's code, and I try to keep out unnecessary dependencies. However, you could always provide the source in the Code Snippets section of this forum or post a link in this thread.

Thanks for the offer.


- Josiah
Josiah Hartzell
Image
DawsonXB360
Posts: 13
Joined: Fri Mar 18, 2011 7:55 pm
Location: 219

Post by DawsonXB360 »

Cobra or silver.slade. Could either of you perhaps send me some source code showing how to load a .irr file and apply collision, I'm having a little trouble with it myself.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

DawsonXB360 wrote:Cobra or silver.slade. Could either of you perhaps send me some source code showing how to load a .irr file and apply collision, I'm having a little trouble with it myself.
If irrBulet doesn't have some automatic way to do it, you should just get all nodes in scene after irr file is loaded and apply physics on them based on what type of node it is.
Working on game: Marrbles (Currently stopped).
Post Reply