irrBP - An Irrlicht - Bullet Physics Wrapper

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

SG57 wrote:I don't know if you want my library source or if you can just type it into your current local copy. Either way I think it should be added to this library! :]
Coding help\improve is always welcome here.
If you want to share your source with us, i'll insert your source into the next SVN update ;)
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Zurzaza wrote:
serengeor wrote:Zurzaza is there any way to create collision body for bounding box?
you can create an object as a "box" (because the bounding box...is a box! :P)...why do you want to create a collision body from the BB?
I want my collisions to be quake3 like :D

I've already made a rigid box around sydney, tough setting position of the box to sydney, sydney is about ~ 4 units higher than the box.

Also is there anyway to restrict body rotating around x,z axes(so it wouldn't fall over)?(don't want to use char controller).
Working on game: Marrbles (Currently stopped).
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

serengeor wrote: Also is there anyway to restrict body rotating around x,z axes(so it wouldn't fall over)?(don't want to use char controller).
You can add a constraint and limit its axis moves (setLinearLowerLimit, ...)

But..what do you mean with "quake 3 collisions-like"?
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

AFAIK it uses bounding boxes to collide with world, and uses also hit-boxes attached to bones.

Have you ever played quake3, half-life 1, or any mod of half-life?
I would like to have this kind of collision system. Actually I would like to have all the physics like these games(I don't need fancy physics like rag-dolls, soft bodies for my game framework).

I'll look into quake3 source now I think, to get the basic Idea of how its working.

thanks for the tip about constraints :]

Edit: Quake3 source is such a mess :shock:
Working on game: Marrbles (Currently stopped).
Monio666
Posts: 14
Joined: Fri Nov 19, 2010 12:37 pm

Post by Monio666 »

Hello again, I'm getting some problems so I hope someone can help me.

Principally is collision detection problems, I want to check if two objects are colliding. First I tried the object1->getBodyPtr()->checkcollidewith(object2->getBodyPtr()), but it always return true, I'm doing it right?

So I used bulletmgr->getWorld()->getBodyCollidingPoint with the two bodys and getting the two points of collision and comparing them to know if it's the same point so the two objects are colliding. This is a good form of doing this or there is a better way to know if two objects are colliding?.

The problem is, I'm rotating manually one of the objects (I put the mass to 0, or doing it kinematic) with setposition and setrotation. And if I rotate the object, then the the collision detection don't work right, I don't know if it's for the method I used to check collision or if I'm not making right the rotation of the body.
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

@Monio: did you try the "isBodyColliding()" function? (is more simple then getCollidingPoint)

@Serengeor: I'll take a look to quake 3 collision system ;)
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Zurzaza wrote: @Serengeor: I'll take a look to quake 3 collision system ;)
Beware its evil!

Is there any way to rotate dynamic rigid body manually(with IrrBP or bullet itself, doesn't matter)?
setRotation() simply doesn't work(the body starts spinning wildly).
Working on game: Marrbles (Currently stopped).
Kordman916
Posts: 23
Joined: Sat Apr 03, 2010 3:44 am

Post by Kordman916 »

Kordman916 wrote:So what exactly am I downloading to get this to work in Code::Blocks on Ubuntu 10.10?
Apparently I'm not important enough to get an answer right? You guys completely skipped over my post.

Now let me ask again:

How do I get IrrBP to work in Irrlicht 1.7.1 in Ubuntu 10.10?

What do I need to download and link in Code::Blocks?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Download bullet, read the read me file that's included there, it should explain how to get bullet working.
Than you should download IrrBP. It has C::B project file which you should use to compile irrBP.
As for linking order look a little bit up, and you should find it.
Working on game: Marrbles (Currently stopped).
SG57
Posts: 66
Joined: Fri May 18, 2007 5:51 am

Post by SG57 »

Kordman916 - I'd love to answer your question so you may get onto developing your application, but I don't have the answer.

I would imagine you'd need Irrlicht 1.7.1, IrrBP and Bullet libraries all compiled under your compiler.

Use CMake to configure Bullet to build for your compiler, build it and link to it's compiled library.
There is a Code::Blocks project file for IrrBP IIRC, use it to compile IrrBP for your compiler, link to it's compiled library.
Compile Irrlicht to get your final library. If you're using GCC, the .a library is already compiled for you.
_______________________________

Anyways - so I have made a few adjustments to my current IrrBP. When I was making my own character controller, I had a hard time getting the rigid body to stay active after setting it's irrlicht node's visibility to false. My character controller doesn't necessarily have a visual representation (ie, a camera flying around) so I overloaded the addRigidSphere and addRigidCapsule functions so they don't require or mess with a scenenode, but still accept an initial position, rotation and radius(for the sphere)/extent (For the capsule).

I've also gotten a rag doll working using raw Bullet and Irrlicht. I'm thinking of making a RagDoll class using IrrBP as I like it's interface. It would require you give it the node with the bones, and a bone-body-relation list (used to link the node's bones to the respective bodies).
__________________________________
...you'll never know what it's like, living your whole life in a dream...
Monio666
Posts: 14
Joined: Fri Nov 19, 2010 12:37 pm

Post by Monio666 »

Zurzaza and serengeor (this may interest you cause i'm rotating bodys).

The isbodycolliding function doesnt work with the precision of getbodycollidingpoint. I mean, I get isbodycoliding true really before the two bodies collides, but with getbodycollidingpoint, it returns true when the body actually collides and has a colliding point. Although, with isbodycolliding I only know if the body is colliding, but it didn't tell me with witch other body is colliding.

This method works good for me, I was asking if there is a better way to check if two specific objects has collided.

And well, my principal problem now, is that I want to move and rotate a body totally manually, and check collision with other objects.

First I have some code that I saw in this forum, to make rotations, something like this:

Code: Select all

void rotate(irr::scene::ISceneNode *node, irr::core::vector3df rot)
{
    irr::core::matrix4 m;
    m.setRotationDegrees(node->getRotation());
    irr::core::matrix4 n;
    n.setRotationDegrees(rot);
    m *= n;
    node->setRotation( m.getRotationDegrees() );
    node->updateAbsolutePosition();
}
With the functions roll,yaw and pitch to rotate in each axis, just like:

Code: Select all

void yaw(irr::scene::ISceneNode *node, irr::f32 rot)
{
    rotate(node, irr::core::vector3df(0.0f, rot, 0.0f) );
}
First, I change the node in the rotate function, to be a CIrrBPRigidBody, so I can use rotate with any type of body in the scene. Wihout any changes, the rotation works well if you rotate from (0,0,0) in any axis, but when you rotate more axis, then it get crazy rotations.

So I change the form of getting the current rotation to node->getIrrlichtNode()->getRotation()

Now the rotation is done well. But what was my surprise, that if I roll de object, the collision detection fails!. If I don't roll the object, it works great, but the moment I roll it, then is like the object is in another position than the one you are seeing the object is. And I see how the object is colliding but I don't get any colliding point and the other object doesn't move of the collision.

So I believe the method of rotation is wrong. First I have a convexhull body, so I tried to make a simple cube and a rigidcube body, and the result was the same.

The rotation code I have now is this:

Code: Select all

void rotate(CIrrBPRigidBody *node, irr::core::vector3df rot)
{
    irr::core::matrix4 m;
	m.setRotationDegrees(node->getIrrlichtNode()->getRotation());
    irr::core::matrix4 n;
    n.setRotationDegrees(rot);
    m *= n;
	node->setRotation(m.getRotationDegrees());
	node->getIrrlichtNode()->updateAbsolutePosition();
}
Something is wrong in all of this and I don't know what is. And I'm using irrBP 0.30(r35)
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

I took knowledge of this bug\feature request, and inserted them into the project's issues list (http://code.google.com/p/irrbp/issues/list).
I'll be at home for the next 2 weeks due to christmas holiday, and i'll work on these bugs.

Thank you very much for your interest in the project and for the bug report.
If you have any ideas about that, or if you want to share your code reviews, i'll pleased to insert them in the project.
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

@ Monio666:
I have fixed the rotations for myself heres the code from another thread:

Code: Select all

/**SAMPLE CODE**/ 
btTransform trans=body->getCenterOfMassTransform(); 
btQuaternion quat; 
quat.setEuler(irr::core::DEGTORAD*x,irr::core::DEGTORAD*y,irr::core::DEGTORAD*z); 
trans.setRotation(quat); 
body->setCenterOfMassTransform(trans); 
Works flawlessly. 8)

P.S. also you should probably activate your body when rotating.
Working on game: Marrbles (Currently stopped).
Monio666
Posts: 14
Joined: Fri Nov 19, 2010 12:37 pm

Post by Monio666 »

This method is good but it doesn't work for me. I want my body to be 0 mass or kinematic, so it only moves and rotates as I say, but collides with the rest of the bodys.
Zurzaza
Posts: 153
Joined: Fri Mar 26, 2010 9:41 pm
Location: Filo (FE), Italy
Contact:

Post by Zurzaza »

Ok, i've got a bunch of news.
- set and get rotation functions finally fixed (using matrix, that are more fast and precise than converting quaternions).
- introduced isPairColliding function (to test collision between two objects)
- fixed isBodyColliding function

so...update now to r40!
irrBP - an Irrlicht - Bullet Physics Wrapper.
The only irrlicht-physics wrapper that uses multithread technology.
Post Reply