Bullet physics animator

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

hey gbox,

can you post your updated irrbullet project file up. i can't build the version posted by the author. version too old, i guess.

thanks.
Image
wuallen
Posts: 67
Joined: Thu Jan 25, 2007 3:07 am
Location: Shanghai

Post by wuallen »

I compile these code, but I get very bad effect. the pin becames dark, and FPS is very low, about 5 or 6, did anyone else get the same bad effect? I don't know where is the problem?
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

hey wuallen

complie with release option then speed up

i meet same dark problem but another project work well i dont now why? too

dlangdev here is soruce

http://jga.or.kr/sboard/download.asp?bo ... ta&idx=114
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
full.metal.coder
Posts: 68
Joined: Sat May 10, 2008 11:30 am
Contact:

Post by full.metal.coder »

I've never managed to get this thing working so I ended writing a Bullet wrapper using a completely different approach. You may be interested in having a look at the code : http://first-king.svn.sf.net/svnroot/fi ... k/physics/

It works quite well but unfortunatley requires to patch Bullet for performance and flexibility reasons (mesh data sharing, physics aware of animations, character controller, ... :D ). I've reported the issues on Bullet forums and task tracker so it should be integrated soon.
wuallen
Posts: 67
Joined: Thu Jan 25, 2007 3:07 am
Location: Shanghai

Post by wuallen »

gbox wrote:
i meet same dark problem but another project work well i dont now why? too
I got the answer of the dark problem.

http://irrlicht.sourceforge.net/phpBB2/ ... p?p=165929[/u]
wuallen
Posts: 67
Joined: Thu Jan 25, 2007 3:07 am
Location: Shanghai

Post by wuallen »

full.metal.coder wrote:I've never managed to get this thing working so I ended writing a Bullet wrapper using a completely different approach. You may be interested in having a look at the code : http://first-king.svn.sf.net/svnroot/fi ... k/physics/

It works quite well but unfortunatley requires to patch Bullet for performance and flexibility reasons (mesh data sharing, physics aware of animations, character controller, ... :D ). I've reported the issues on Bullet forums and task tracker so it should be integrated soon.
thank your replying. At least I got the clue of my slow problem. It is really a problem of mine, I have been so worried about this. can you explain how to patch this problem, for me, more waiting more pains.
EvilAlex
Posts: 6
Joined: Fri Aug 29, 2008 12:02 am
Location: Moscow, Russia
Contact:

Post by EvilAlex »

Thanks to the author of the code!
I haven't use this exact code, but rather, used it as a tutorial to write my own. Bullet has very poor documentation (or it's just me too lazy to search), so this code helped a lot.
Thanks again! =)
go
Posts: 28
Joined: Mon Oct 20, 2008 7:53 am

Post by go »

OK

I edit first Irrlicht and bullet animator sourcecode for Irrlicht 1.4.2 and bullet 2.7.2 ver in visualc++ 2008

i up the sourcecode.

before compile this code, you shoud make your Extras\GIMPACT\include folder in your visual studio include option.

and I'll make serialized ver source either

thanks


http://xn--u8jua7b1498a.jp/dl
go
Posts: 28
Joined: Mon Oct 20, 2008 7:53 am

Post by go »

Jiang
Posts: 77
Joined: Tue Feb 20, 2007 11:03 am

Post by Jiang »

go wrote:OK

I edit first Irrlicht and bullet animator sourcecode for Irrlicht 1.4.2 and bullet 2.7.2 ver in visualc++ 2008

i up the sourcecode.

before compile this code, you shoud make your Extras\GIMPACT\include folder in your visual studio include option.

and I'll make serialized ver source either

thanks


http://xn--u8jua7b1498a.jp/dl
Hey go,

I downloaded the above zip file, but failed to open it. My 7-zip reported me invalid zip file format. Tried several times but had no luck.

Would you please check the zip file again.

Thank you for your time.
wEEp
Posts: 70
Joined: Thu Nov 27, 2008 7:55 am

Post by wEEp »

from where do i get the Bullet library? ;O
link3rn3l
Posts: 81
Joined: Wed Nov 15, 2006 5:51 pm

Post by link3rn3l »

100% working

compiled with irrlicht SVN:

http://code.google.com/p/fenixpack/downloads/list


thanks for the wrapper..!!!
Last edited by link3rn3l on Mon Jan 25, 2010 6:51 pm, edited 1 time in total.
Bennu (Best 2d and 3D dev-tool)
http://bennupack.blogspot.com

Pixtudio (Best 2D development tool)
http://pixtudiopack.blogspot.com

Bennu3D(3D Libs for bennu)
http://3dm8ee.blogspot.com/

Colombian Developers - Blog:
http://coldev.blogspot.com/
enif
Posts: 12
Joined: Sun Nov 15, 2009 5:31 pm
Location: Prague, Czech Republic

Small enhancement for terrain nodes - for the big ones

Post by enif »

Hi!

Thes animator code works great with Irrlicht 1.6 and Bullet 2.75. Thanks! Great work!

Because I am using 513x513 terrain nodes in my game, I had to change this method in CBulletPhysicsUtils.cpp:

Code: Select all

btTriangleMesh * ConvertTerrainToBulletTriangleMesh(
    irr::scene::ITerrainSceneNode* terrain,
    const irr::core::vector3df& Scaling)
      {
         //mesh converting

            btVector3 vertices[3];
            irr::u32 j,k,index,numVertices,numIndices;
            irr::u16* mb_indices16;
			irr::u32* mb_indices32;
			video::E_INDEX_TYPE indicesType;
            btTriangleMesh *triangleMesh;

            irr::scene::ITerrainSceneNode *pTerrain = terrain;


			scene::CDynamicMeshBuffer* buffer = 0;

			numVertices = terrain->getMesh()->getMeshBuffer(0)->getVertexCount();
			if (numVertices <= 65536)
			{
				//small enough for 16bit buffers
				buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT);
			}
			else
			{
				//we need 32bit buffers
				buffer = new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_32BIT);
			}

            pTerrain->getMeshBufferForLOD(*buffer, 0);

            numVertices = buffer->getVertexCount();
            numIndices = buffer->getIndexCount();
			indicesType = buffer->getIndexType();

			if (indicesType == video::EIT_16BIT)
			{
				mb_indices16 = buffer->getIndices();

				irr::video::S3DVertex2TCoords* mb_vertices = (irr::video::S3DVertex2TCoords*)buffer->getVertices();
				btTriangleMesh *pTriMesh = new btTriangleMesh();
				irr::core::vector3df scaling = Scaling;

				for(j = 0; j < numIndices; j += 3)
				{ 
					//index into irrlicht data
					for (k = 0; k < 3; k++)
					{
						index = mb_indices16[j+k];

						// we apply scaling factor directly to verticies
						vertices[k] = btVector3(mb_vertices[index].Pos.X*scaling.X,
						mb_vertices[index].Pos.Y*scaling.Y,
						mb_vertices[index].Pos.Z*scaling.Z);
					}

					pTriMesh->addTriangle(vertices[0], vertices[1], vertices[2]);
				}

				triangleMesh = pTriMesh;
			}
			else if (indicesType == video::EIT_32BIT)
			{
				mb_indices32 = (u32*)buffer->getIndices();

				irr::video::S3DVertex2TCoords* mb_vertices = (irr::video::S3DVertex2TCoords*)buffer->getVertices();
				btTriangleMesh *pTriMesh = new btTriangleMesh();
				irr::core::vector3df scaling = Scaling;

				for(j = 0; j < numIndices; j += 3)
				{ 
					//index into irrlicht data
					for (k = 0; k < 3; k++)
					{
						index = mb_indices32[j+k];

						// we apply scaling factor directly to verticies
						vertices[k] = btVector3(mb_vertices[index].Pos.X*scaling.X,
						mb_vertices[index].Pos.Y*scaling.Y,
						mb_vertices[index].Pos.Z*scaling.Z);
					}

					pTriMesh->addTriangle(vertices[0], vertices[1], vertices[2]);
				}

				triangleMesh = pTriMesh;
			}
			else
			{
				// bad indices type!
				buffer->drop();

				return NULL;
			}

			buffer->drop();

			return  triangleMesh;
      }
Works for me... :-)

The old code works perfectly for 256x256 terrains (aka 65536 vertices limit), but for anything bigger, you are lost.
Post Reply