Page 21 of 31

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Mon Aug 15, 2011 7:19 pm
by serengeor
polylux wrote:
serengeor wrote:
polylux wrote:Well, seemingly it's the wrong way to create a triangle collision mesh from your terrain as with a sufficiently sized terrain the simulation pretty fast slows down to a slide show. Bullet offers the btHeightfieldTerrainShape (Link) for such things. I am currently very tempted to extend irrBullet's functionality by this - as long as no one else has done it already.
If so, just tell me please.

p.
How big was your terrain (how much vertices)?
roughly 350k of verteces at LOD 0
I see, I haven't tried going that big (I think) 8)

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Fri Aug 19, 2011 8:10 pm
by Granyte
i'm facing a similar issue with my project using pure bullet the simulation slows down to a crawl with a terrain larger then 256*256 and even worst my final implementation will require 6 height map of 2048x2048

so i think the only solution to the issue will be to separate the terrain into patches and load, unload the mesh data to bullet at run time depending on the position of the player since i don't think i can in my implementation use the height field implementation

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Tue Sep 13, 2011 7:55 am
by brianempson
Any idea what would cause the Makefile to not function correctly:

brian@www ~/server_code/source/irrBullet-0.1.71/build $ make
make: *** No rule to make target `BulletCollision/CollisionShapes/btCollisionShape.h', needed by `../source/softbody.o'. Stop.
brian@www ~/server_code/source/irrBullet-0.1.71/build $

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Tue Sep 13, 2011 8:56 am
by mongoose7
BulletCollision/CollisionShapes/btCollisionShape.h doesn't exist. You're probably in the wrong directory or you need -I<bullet directory>.

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Mon Sep 26, 2011 2:01 pm
by Rocko Bonaparte
Is there some way with irrBullet or the underlying Bullet physics library to reposition something instantly in space? This is coming up particularly in creating game entities. I might not have the position information up front, so the mesh is first placed at (0, 0, 0), but maybe a few lines of code later it'll get put in its real spot. This is happening between simulation steps so I wouldn't expect any change in physics. I can't then reposition Irrlicht's mesh node and get the physics wrapper to understand it. I'm afraid I have to completely re-create the physics object. I would rather not argue about why I'm not getting the position to it right then and there, since I expect eventually I'd want to do something like teleport an object without having a problem.

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Mon Sep 26, 2011 2:39 pm
by serengeor
With bullet I can position the object whereever I need it to be by getting its center of mass transform, modifying its origin and setting it back to the body. At least it works for my level editor, but I'm sure irrBullet wouldn't cause too much trouble doing that. Maybe there's even helper function to do that in irrBullet(I don't really know, as I'm not using it).

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Mon Sep 26, 2011 3:56 pm
by Rocko Bonaparte
I think I ended up doing this in the end. I forgot that previously I had tried to get the world transform matrix, and change the translation vector to the new coordinates. It appeared that after doing this that my frame rate dropped, despite not doing this every frame. That turned out to be a fluke. IMO it's still kind of silly and I might write a helper for it. At the least, it would be easier to set the translation vector directly. Right now I have to copy the matrix, call the method to set the translation, then store the new matrix over the existing one. Again, this isn't something happening in bulk from frame-to-frame, but it hits my C++ OCD impulse.

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Mon Sep 26, 2011 6:52 pm
by serengeor
For me this works pretty well:

Code: Select all

btTransform t=m_rigidBody->getCenterOfMassTransform();
        t.setOrigin(newVal);
        this->m_rigidBody->setCenterOfMassTransform(t);
Though I haven't really done any speed measures here, but it seemed to be pretty fast. At least editing position from the GUI/3d view didn't cause too much trouble.

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Thu Sep 29, 2011 5:37 pm
by cobra
Rocko Bonaparte wrote:Is there some way with irrBullet or the underlying Bullet physics library to reposition something instantly in space? This is coming up particularly in creating game entities. I might not have the position information up front, so the mesh is first placed at (0, 0, 0), but maybe a few lines of code later it'll get put in its real spot. This is happening between simulation steps so I wouldn't expect any change in physics. I can't then reposition Irrlicht's mesh node and get the physics wrapper to understand it. I'm afraid I have to completely re-create the physics object. I would rather not argue about why I'm not getting the position to it right then and there, since I expect eventually I'd want to do something like teleport an object without having a problem.

Hi Rocko,

irrBullet makes this very easy. First, the object is located in the world wherever your scene node is at creation time (if you choose to do it that way).

The second option is this (taken from the irrBullet FAQ included with the SDK; please refer to this and the Doxygen documentation for future questions because it's likely already answered):

Code: Select all

1.2
A: How do I change the position or rotation of one of my
objects?
Q: Changing the world transform of an object is easy with
2
irrBullet.
Here is an example:
irr::core::matrix4 mat;
mat.setTranslation(irr::core::vector3df(0,1000,1000));
mat.setRotationDegrees(irr::core::vector3df(0,0,0));
object->setWorldTransform(mat);

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Thu Sep 29, 2011 6:21 pm
by serengeor
cobra wrote: irrBullet makes this very easy. First, the object is located in the world wherever your scene node is at creation time (if you choose to do it that way).
How does this make it any easier than it already is, despite the fact that it uses irrlicht matrix4?

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Fri Sep 30, 2011 8:45 am
by randomMesh
Reminds me of functions like

Code: Select all

 
void setNodePosition(irr::scene::ISceneNode* node, const irr::core::vector3df& position)
{
    node->setPosition(position);
}
 
I really don't get the point of wrappers.

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Fri Sep 30, 2011 11:59 am
by serengeor
randomMesh wrote:Reminds me of functions like

Code: Select all

 
void setNodePosition(irr::scene::ISceneNode* node, const irr::core::vector3df& position)
{
    node->setPosition(position);
}
 
I really don't get the point of wrappers.
yeah, I also don't understand why would you need to wrap almost everything in bullet :roll:
It has such a nice interface to interact with that you hardly need few helper classes for it.

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Fri Sep 30, 2011 1:34 pm
by Radikalizm
randomMesh wrote:Reminds me of functions like

Code: Select all

 
void setNodePosition(irr::scene::ISceneNode* node, const irr::core::vector3df& position)
{
    node->setPosition(position);
}
 
I really don't get the point of wrappers.
This is not an issue of the code being a wrapper function, this is just a matter of either a stupid programmer, or someone who is very attached to procedural programming and therefore tries to negate all the principles of an OO design in an environment which was created with OO in mind (which is pretty stupid too when you look at it)

You wouldn't believe the amount of code I've seen written like this, it's ridiculous

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Fri Sep 30, 2011 9:17 pm
by Barratator
Hello,
i got a small memory leak, if I'm creating a BoxShape and RigidBody.

Code: Select all

 
ISphereShape* shape = new ISphereShape(node, mass, false);
shape->setUnscaledRadius(r);
IRigidBody* body = this->world->addRigidBody(shape,group,mask);
 
Later I delete the body with removeCollisionObject. But Visual Studio says all the time that there is still an object allocated :(

Code: Select all

Detected memory leaks!
Dumping objects ->
{604} normal block at 0x01D16610, 368 bytes long.
 Data: <  N             > 00 E7 4E 01 CD CD CD CD CD CD CD CD CD CD CD CD 
Object dump complete.
Has anybody an idea, how I can free this memory?

Thanks!

Re: irrBullet 0.1.71 - Bullet physics wrapper

Posted: Fri Sep 30, 2011 9:54 pm
by Radikalizm
@Barratator: The memory leak dump provides you with an allocation number (in your case 604), set a breakpoint at this allocation and check which object is being created and try to trace this object throughout the program until its destruction, if it is being destroyed at all

If it's not being destroyed or dropped (when reference counted) it's pretty obvious what you need to do

If it is being dropped you should check for objects grabbing the object and not dropping it, and for cyclic references which result in the object never getting dropped (these can be harder to trace)