irrBullet 0.1.8 - Bullet physics wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by Granyte »

from what i understand bullet use the aabb to filter the more precise collision code and avoid making some per triangle cheq on every shape every time
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by mubashar »

serengeor wrote:
mubashar wrote:@polylux looks valid to you ?
Didn't he just say that?
wikipedia wrote:In geometry, an axis-aligned object (axis-parallel, axis-oriented) is an object in n-dimensional space whose shape is aligned with the coordinate axes of the space.
I'm pretty sure bullet does not really do any real collision calculations based on AABB. (is that even bullet's AABB?)

http://en.wikipedia.org/wiki/Bounding_volume wrote:In collision detection, when two bounding volumes do not intersect, then the contained objects cannot collide, either.
When it's all over, it's not who you were. It's whether you made a difference
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by serengeor »

mubashar wrote:
serengeor wrote:
mubashar wrote:@polylux looks valid to you ?
Didn't he just say that?
wikipedia wrote:In geometry, an axis-aligned object (axis-parallel, axis-oriented) is an object in n-dimensional space whose shape is aligned with the coordinate axes of the space.
I'm pretty sure bullet does not really do any real collision calculations based on AABB. (is that even bullet's AABB?)

http://en.wikipedia.org/wiki/Bounding_volume wrote:In collision detection, when two bounding volumes do not intersect, then the contained objects cannot collide, either.
That applies to transformed bounding boxes or even up-scaled bounding boxes that can contain the full object. While with AABB the object can sometimes leave it,
Working on game: Marrbles (Currently stopped).
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by mubashar »

@serengeor can you identify from my post (screenshots) which bounding Box is this ... actually my question is is it possible to transform this when object when scene node transforms... as it is happening in plain bullet demo ... but not in my case using Irrbullet
When it's all over, it's not who you were. It's whether you made a difference
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by serengeor »

mubashar wrote:@serengeor can you identify from my post (screenshots) which bounding Box is this ... actually my question is is it possible to transform this when object when scene node transforms... as it is happening in plain bullet demo ... but not in my case using Irrbullet
Scene node?? if you transform scene node instead of bullet body it wont update itself. Unless you're already using irrBullet, in that case it would reset scene node to bullet's body's position. Anyways you shouldn't do that as will make you need to update the body itself to the scene nodes transform. Better transform bullet's bodies and scene nodes will follow them (if you're using irrBullet ofc.).
Working on game: Marrbles (Currently stopped).
polylux
Posts: 267
Joined: Thu Aug 27, 2009 12:39 pm
Location: EU

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by polylux »

mubashar wrote:@serengeor can you identify from my post (screenshots) which bounding Box is this ... actually my question is is it possible to transform this when object when scene node transforms... as it is happening in plain bullet demo ... but not in my case using Irrbullet
Wicked. I told you. serengeor told you. The one in the second screenshot is the axis-aligned bounding box. It's the one that encloses your geometry given its bounding axes are parallel to your x, y and z axis in world space. So once the geometry (mesh) is rotated, the AABB will only change in size, not in orientation. The other part of your question is perfectly answered in serengeor's post.
beer->setMotivationCallback(this);
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by mubashar »

@serengeor yes i am using Irrbullet Rigidbody as cars Chassi and now my question is now same
@serengeor can you identify from my post (screenshots) which bounding Box is this ... actually my question is is it possible to transform this when object when scene node transforms... as it is happening in plain bullet demo ... but not in my case using Irrbullet
When it's all over, it's not who you were. It's whether you made a difference
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by RdR »

mubashar wrote:@serengeor yes i am using Irrbullet Rigidbody as cars Chassi and now my question is now same
@serengeor can you identify from my post (screenshots) which bounding Box is this ... actually my question is is it possible to transform this when object when scene node transforms... as it is happening in plain bullet demo ... but not in my case using Irrbullet
Take a look in the irrBullet code, which box is drawn.
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by zerochen »

hi

first of all nice work:)

i have some questens about it:
1)
in the destruktor of rigidbody and softbody stands

Code: Select all

if(collID)
        delete collID;
i think it must be in the base class (icollisionobject) because it is there declared

2)
i think removeCollisionObject and other remove func are "slow" if you had many objects
because if it found the obj that will be deleted the loop will go on
maybe a break if ob found is missing?

3)
in btTriangleMesh *ITriangleMeshShape::getTriangleMesh(IMesh* const mesh)
at the end stands:
if(pTriMesh)
return pTriMesh;
i think it makes no sense at the end because the var pTriMesh is used before. if it is really necessary put it before the loop
e.g.
if(!pTriMesh)
return nullptr
4)
in IGImpactMeshShape the member var btGImpactMeshShape* gimpactShape is declared
it is not necessary to store it in gimpactShape becauce it is stored by the base class (shape)
that is a just a little bit confusing not a error itself

generell questions:
1)
what was your purpose to use UniqueID and dont let the user to handle it like in irrlicht?
eg

Code: Select all

IGImpactMeshShape(ISceneNode *n, IMesh *collMesh, f32 m, s32 id = -1)
2)
in the collision loop

Code: Select all

        
for(int i=0; i < world->getNumManifolds(); i++)
        {
                ICollisionCallbackInformation *info = world->getCollisionCallback(i);
 
                bool hasCollideAttribute = (info->getBody0()->getAttributes()->existsAttribute("collide")); // <-2.1 is an obj that is non static only gets the colide attribute?
                ICollisionObject* obj = (hasCollideAttribute) ? info->getBody0() : info->getBody1();
 
                ((IRigidBody*)info->getBody0())->applyForce(core::vector3df(0,10000,0), core::vector3df(0,1,0), ERBTS_LOCAL); //<-2.2 is this the right way to bounce the body away from the sec? is a effektor here better?
 
                info->getPointer()->clearManifold();  //<-2.3 is this the right way to clear & delete the info?
                delete info;
        }       
 
thx for your help
chris
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by cobra »

Hi Zerochen,

I greatly appreciate you reporting these findings to me so that I could fix them.

These are quite surprising as they are not things that I would do in a normal state-of-mind, but I've worked a lot on IrrBullet when I was tired, hurrying, or concentrating on deep implementations or big changes so I guess that is probably how they weaseled their ways in there. Also, these oddities are in code that dates back to the start of IrrBullet, so I haven't worked with them in quite some time; in fact, I haven't worked on IrrBullet much in quite some time, either. :)

With that said, all of the things you mentioned have been fixed. Update from the IrrBullet trunk to get the new code.

Now on to your question about UniqueID:

I chose not to let the user handle UniqueID so that it can never be -1 and there can never be any duplicates. It should never be -1 because the IrrBullet system uses UniqueID to identify collision objects.

About the collision loop:

"<-2.1 is an obj that is non static only gets the colide attribute?"
The "collide" attribute was only used in the collision example for special types of objects. It is not added by IrrBullet.

"<-2.2 is this the right way to bounce the body away from the sec? is a effektor here better?"
If you want to apply a single instantaneous impulse to something, use applyImpulse() or internalApplyImpulse().

If you want to bounce the object away from where it collided, use something like this:

Code: Select all

SManifoldPoint point = info->getContactPoint(i);
irr::f32 speed = 10.0f;
static_cast<IRigidBody*>(info->getBody0())->internalApplyImpulse(point.getNormalWorldOnB().normalize()*speed, ERBTS_WORLD);
I wrote this code directly in my reply, so it hasn't been tested, but it should work just fine. Note that you must loop through all of the contact points in the collision callback.

Make sure you check that point.getDistance() is equal to 0 to make sure it is an actual physical collision and not just an AABB intersection.

Also, don't use an affector for something like this. Affectors are for behaviors that are meant to persist for an object's lifetime or for special cases where an affector would be useful.


"<-2.3 is this the right way to clear & delete the info?"
Yes, that is the correct way to delete the info. I might end up renaming the function "getCollisionCallback()" to "createCollisionCallback()" so that it's more obvious that the returned pointer must be manually deleted.


I hope that covers all that you need to know. Thank you for using IrrBullet, and thank you for being an important part of its progress (by reporting bugs and oddities).
Josiah Hartzell
Image
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by RdR »

I created a small patch to add an extra constructor IBvhTriangleMeshShape.
This is very usefull if you want to create a RigidBody for the TerrainSceneNode.
BenT
Posts: 1
Joined: Wed Mar 07, 2012 2:19 am

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by BenT »

Thank you for irrBullet. It was easy to set up and looks really usefull. This is the first time I have really tried to understand and use it. I can't for the life of me figure out how to create terrain that works with irrbullet. Could you post an example of how to do this given an ITerrainSceneNode?
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by RdR »

BenT wrote:Thank you for irrBullet. It was easy to set up and looks really usefull. This is the first time I have really tried to understand and use it. I can't for the life of me figure out how to create terrain that works with irrbullet. Could you post an example of how to do this given an ITerrainSceneNode?
Take a look at this post: http://irrlicht.sourceforge.net/forum/v ... 30#p260684
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by ulao »

Hi would you consider/have you considered, making an irredit plug-in?
irrlichtuser18
Posts: 3
Joined: Tue Feb 28, 2012 5:46 pm

Re: irrBullet 0.1.71 - Bullet physics wrapper

Post by irrlichtuser18 »

Hey all,

I am compiling irrBullet 1.7.1 on Ubuntu 11.10. Running a simple make command to compile irrBullet yields the following error: make:

Code: Select all

*** No rule to make target `Bullet/btBulletDynamicsCommon.h', needed by `../source/trianglemeshshape.cpp'.  Stop. 
The full log is:

Code: Select all

 
MYUSERNAME@ubuntu:~/Downloads/irrBullet-0.1.71/build$ make
make: Circular ../source/trianglemeshshape.cpp <- ../source/trianglemeshshape.cpp dependency dropped.
make: *** No rule to make target `Bullet/btBulletDynamicsCommon.h', needed by `../source/trianglemeshshape.cpp'.  Stop.
 
Now, I haven't really done anything other than "cd" into the build directory. Judging from the readme, there aren't any external dependencies. If anyone could provide some assistance, it would be greatly appreciated.

Thank you in advance
Post Reply