irrBullet 0.1.8 - Bullet physics wrapper
-
- Posts: 194
- Joined: Thu Mar 18, 2010 3:31 am
- Contact:
Alright, I'm still getting errors, although it doesn't look like any of them are because of missing Bullet libs. It's all stuff it should be finding in the standard library, but all of it is getting called from the IrrBullet files.
LazerBlade
When your mind is racing, make sure it's not racing in a circle.
3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
When your mind is racing, make sure it's not racing in a circle.
3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
-
- Posts: 194
- Joined: Thu Mar 18, 2010 3:31 am
- Contact:
I've learned that taking out my IrrBullet references(except for the .h file) greatly reduces the number of errors I get. Don't know if that helps...
I've also tried compiling hello world and basic applications in my workspace, the standard libraries seem to be working fine.
I've also tried compiling hello world and basic applications in my workspace, the standard libraries seem to be working fine.
LazerBlade
When your mind is racing, make sure it's not racing in a circle.
3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
When your mind is racing, make sure it's not racing in a circle.
3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
how do i use the collision callback with this?
i try to follow collision example, but it didn't give me the correct collision.
sometimes, even if 2 bodies didn't collide it tell me that 2 bodies has collide.
but, the collision response is correct though.
here is my collision handle code
and my bodies creation code
so what do i do wrong?
here is the pic.
as you can see, the car didn't hit the wall. but the collision is reported.
i try to follow collision example, but it didn't give me the correct collision.
sometimes, even if 2 bodies didn't collide it tell me that 2 bodies has collide.
but, the collision response is correct though.
here is my collision handle code
Code: Select all
for(u32 i=0; i < world->getNumManifolds(); i++)
{
ICollisionCallbackInformation *info = world->getCollisionCallback(i);
ICollisionObject* obj1 = info->getBody0();
ICollisionObject* obj2 = info->getBody1();
if(obj1->getAttributes()->existsAttribute("RCCar") && obj2->getAttributes()->existsAttribute("wall"))
{
info->getContactPoint(0);
u16 id = obj1->getAttributes()->getAttributeAsInt("id");
switch(id)
{
case 1:
if (car->dead(dT))
input->setLayer(UTAMA);
break;
}
}
if(obj2->getAttributes()->existsAttribute("RCCar") && obj1->getAttributes()->existsAttribute("wall"))
{
u16 id = obj2->getAttributes()->getAttributeAsInt("id");
switch(id)
{
case 1:
if (car->dead(dT))
std::cout<<"Mati"<<std::endl;
break;
}
}
if(obj2->getAttributes()->existsAttribute("RCCar") && obj1->getAttributes()->existsAttribute("RCCar"))
{
u16 id = obj1->getAttributes()->getAttributeAsInt("id");
switch(id)
{
case 1:
if (car->dead(dT))
std::cout<<"Mati"<<std::endl;
break;
}
}
}
Code: Select all
IGImpactMeshShape *shape = new IGImpactMeshShape(body, smgr->getMesh("../Mesh/PickUpColl.3ds"), 1400);
rBody = world->addRigidBody(shape);
rBody->setActivationState(EAS_DISABLE_DEACTIVATION);
vehicle = world->addRaycastVehicle(rBody);
rBody->getAttributes()->addBool("RCCar", true);
rBody->getAttributes()->addInt("id", id);
Code: Select all
ICollisionShape *shape1 = new IBvhTriangleMeshShape(a, smgr->getMesh("../Mesh/FastTripCollW.3ds"), 0.0);
shape1->setMargin(0.07f);
wall = world->addRigidBody(shape1);
wall->setCollisionFlags(ECF_STATIC_OBJECT);
wall->getAttributes()->addBool("wall", true);
here is the pic.
as you can see, the car didn't hit the wall. but the collision is reported.
Hi mataanjin. Collisions are reported as soon as there is an AABB overlap. You have to check the distance of the collision (between actual shape geometry).mataanjin wrote:...
Code: Select all
SManifoldPoint& ICollisionCallbackInformation::getContactPoint(irr::u32 index)
irr::f32 SManifoldPoint::getDistance() const
Use:
Code: Select all
callbackInfo->getContactPoint(0).getDistance();
@cobra
i have change to this
still it report incorrectly.
how to check the actual shape geometry?
edit:
got it, i change my if to this
at least it work
thanks
i have change to this
Code: Select all
for(u32 i=0; i < world->getNumManifolds(); i++)
{
ICollisionCallbackInformation *info = world->getCollisionCallback(i);
ICollisionObject* obj1 = info->getBody0();
ICollisionObject* obj2 = info->getBody1();
int numContacts = info->getPointer()->getNumContacts();
if(info->getContactPoint(i).getDistance() < 0.01f && info->getContactPoint(i).getLifeTime() < 2.0f)
{
std::cout<<"kena "<<numContacts<<std::endl;
if(obj1->getAttributes()->existsAttribute("RCCar") && obj2->getAttributes()->existsAttribute("wall"))
{
info->getContactPoint(0);
u16 id = obj1->getAttributes()->getAttributeAsInt("id");
switch(id)
{
case 1:
if (car->dead(dT))
input->setLayer(UTAMA);
break;
}
}
if(obj2->getAttributes()->existsAttribute("RCCar") && obj1->getAttributes()->existsAttribute("wall"))
{
u16 id = obj2->getAttributes()->getAttributeAsInt("id");
switch(id)
{
case 1:
if (car->dead(dT))
std::cout<<"Mati"<<std::endl;
break;
}
}
if(obj2->getAttributes()->existsAttribute("RCCar") && obj1->getAttributes()->existsAttribute("RCCar"))
{
u16 id = obj1->getAttributes()->getAttributeAsInt("id");
switch(id)
{
case 1:
if (car->dead(dT))
std::cout<<"Mati"<<std::endl;
break;
}
}
}
}
how to check the actual shape geometry?
edit:
got it, i change my if to this
Code: Select all
if( abs(info->getContactPoint(i).getDistance()) < 0.1f && numContacts > 0)
thanks
Program Crashing
Hello, I am new to Irrlicht and Bullet, but not C++.
I am trying to simply implement some of the HelloWorld functions into a simple little starting platform for me to learn more about game/graphic programming with. I can successfully compile and run the HelloWorld example and it works great. I wrote a basic framework class based on the example in HelloWorld. However, I am having issues getting it to successfully run. I compile with no problems, but it crashes before it even displays anything. Most of my code is very very similar to the HelloWorld example and I simply cannot find anything wrong with it to cause this kind of behavior.
If someone would look at my project (Code::Blocks) and give me some advice, I would be greatly appreciative.
You can download the project here: http://brokemeetscollege.com/projects/life-sim.zip
I am trying to simply implement some of the HelloWorld functions into a simple little starting platform for me to learn more about game/graphic programming with. I can successfully compile and run the HelloWorld example and it works great. I wrote a basic framework class based on the example in HelloWorld. However, I am having issues getting it to successfully run. I compile with no problems, but it crashes before it even displays anything. Most of my code is very very similar to the HelloWorld example and I simply cannot find anything wrong with it to cause this kind of behavior.
If someone would look at my project (Code::Blocks) and give me some advice, I would be greatly appreciative.
You can download the project here: http://brokemeetscollege.com/projects/life-sim.zip
Re: Program Crashing
MichaelR wrote: Hello, I am new to Irrlicht and Bullet, but not C++.
Code: Select all
if(keys[KEY_ESCAPE]){
break;
}
And after you solve that, it still won't work as you expect, because you never registered your event receiver anywhere.
Hi,
Could someone tell the proper way to move a character with keys and still respond correctly to collisions (stop against walls, climb slopes, etc.)???
It is not necessary any code, just an explanation.
I'm doing it in two ways, but both act the same, characters are going trough walls, basically I'm setting the translation of the node manually with a matrix4.
I tried applying impulse, characters get stuck in the floor, so no move (it moves just when is jumping), lower the friction to zero, nothing changes; then tried with linear velocity, but I got the same results.
I know this is not a problem about irrBullet (it is just me not knowing Bullet itself), but I ask here because in Bullet's forum most questions get never answers.
Could someone tell the proper way to move a character with keys and still respond correctly to collisions (stop against walls, climb slopes, etc.)???
It is not necessary any code, just an explanation.
I'm doing it in two ways, but both act the same, characters are going trough walls, basically I'm setting the translation of the node manually with a matrix4.
I tried applying impulse, characters get stuck in the floor, so no move (it moves just when is jumping), lower the friction to zero, nothing changes; then tried with linear velocity, but I got the same results.
I know this is not a problem about irrBullet (it is just me not knowing Bullet itself), but I ask here because in Bullet's forum most questions get never answers.
Re: Program Crashing
Stupid mistake there, but I fixed it.Xaryl wrote:MichaelR wrote: Hello, I am new to Irrlicht and Bullet, but not C++.keys is never initialized.Code: Select all
if(keys[KEY_ESCAPE]){ break; }
And after you solve that, it still won't work as you expect, because you never registered your event receiver anywhere.
I re-structured the code a bit and I am now correctly registering the event receiver as far as I know. However, the program still crashes when registering the receiver... I have uploaded the updated version of the code. The debugger is telling me segfault in createIrrXMLReader in Irrlicht.dll.
http://brokemeetscollege.com/projects/life-sim.zip
-
- Posts: 30
- Joined: Fri Jan 08, 2010 3:30 pm
Hello,
first of all: Sorry for my bad english Wink
I'm trying to use your irrBullet in my project (with Visual Studio 2010). In irrBullet 1.7 I can't find all required *.lib-Files, so I can't compile it.
When I'm trying to use irrBullet 1.7.1 there is only the file "irrBullet.lib" for VS2010, and a few libs for VS2008 - Both types aren't work for me.
When I use the 2010-irrBullet-lib i get a lots of errors with not resolved external symbols,...
Is that a known problem? What can I do to use irrBullet?
Btw...Nice Projekt! Smile
Thanks!
[I already sent it to cobra, but he didn't answered]
first of all: Sorry for my bad english Wink
I'm trying to use your irrBullet in my project (with Visual Studio 2010). In irrBullet 1.7 I can't find all required *.lib-Files, so I can't compile it.
When I'm trying to use irrBullet 1.7.1 there is only the file "irrBullet.lib" for VS2010, and a few libs for VS2008 - Both types aren't work for me.
When I use the 2010-irrBullet-lib i get a lots of errors with not resolved external symbols,...
Is that a known problem? What can I do to use irrBullet?
Btw...Nice Projekt! Smile
Thanks!
[I already sent it to cobra, but he didn't answered]
Re: Program Crashing
Your codes compiled and I was able to quit with ESC and shoot the cubes with left mouse click.MichaelR wrote: However, the program still crashes when registering the receiver... I have uploaded the updated version of the code. The debugger is telling me segfault in createIrrXMLReader in Irrlicht.dll.
I am too lazy to scrutinise the lines one by one, and since I can't reproduce the crash, I will leave it here.
p.s. It was tested on a Linux and thus obviously not with the library files you provided.
Re: Program Crashing
Hmm, I'll try rebuilding the libraries, thanks.Xaryl wrote:Your codes compiled and I was able to quit with ESC and shoot the cubes with left mouse click.MichaelR wrote: However, the program still crashes when registering the receiver... I have uploaded the updated version of the code. The debugger is telling me segfault in createIrrXMLReader in Irrlicht.dll.
I am too lazy to scrutinise the lines one by one, and since I can't reproduce the crash, I will leave it here.
p.s. It was tested on a Linux and thus obviously not with the library files you provided.
Update: Rebuild irrlicht and now it works great! Thank you for your help.
-
- Posts: 48
- Joined: Tue Aug 31, 2010 6:27 am
Right now I have the player represented as a ninja on some ground. Generally I can move the ninja around with a joystick by applying a linear velocity. This works pretty well. What I can't figure out is how to spin the ninja around to face the direction being aimed at with the joystick. It looks like Bullet has taken over not only setting position, but also rotation.
I can apply spin through angular velocities or torque, but I can't anticipate the correct amount to apply since I don't necessarily know when the next frame and physics simulation is going to complete. So I'm at a bit of a loss as to how much velocity or force to apply. Once I'm within, say, 5 degrees either way of the angle I want I can have it curb all rotation, but getting there without dramatic overshoot or a slow undershoot is the problem.
Any ideas?
I can apply spin through angular velocities or torque, but I can't anticipate the correct amount to apply since I don't necessarily know when the next frame and physics simulation is going to complete. So I'm at a bit of a loss as to how much velocity or force to apply. Once I'm within, say, 5 degrees either way of the angle I want I can have it curb all rotation, but getting there without dramatic overshoot or a slow undershoot is the problem.
Any ideas?
I think that the best route for this would be to sit and play with the physics values for your object. It took a bit of tweaking in my game, but I eventually achieved the effect that you're after.
I would recommend adjusting the amount of torque being applied, along with the rotational dampening.
I would recommend adjusting the amount of torque being applied, along with the rotational dampening.
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
"I'll find out if what I deleted was vital here shortly..." -d3jake