Dynamic TriMesh

OGREHEAD

05-07-2013 15:56:20

Is it not possible to have dynamic trimesh?

I have created a cone like mesh and trimeshed it to a rigidbody.

The gravity works for it but it does not collide with plane only a box shape.
And when it collides it does not rotate when hitting box shape.

Is it only possible to have trimesh as terrain or similar and not a teapot object or such?

In some of the bullet demos are objects not similar to meshes, like trimeshed and then just work as one would expect when colliding, such as rotating?

AlexeyKnyshev

08-07-2013 03:39:33

Possible, there is softbody example in bullet samples. I believe that we can lock some (or all) vertexes of it and update them manually when needed. Is it an a future request? :D

OGREHEAD

10-07-2013 22:55:30

I am not sure I understand.

Once I think I managed to convert like a dog mesh or something to a trimesh exactly the same shape as the dog shape and the collision would work as ecpected when being thrown around, instead of having a box or sphere collision shape.
But I am not sure I actually had it working or if this is easily possible or not.

Now I have the trished object but it can not be dynamic only at a static position, that is it does not rotate when falling and hitting other objects.

I am not sure the softbody is what I need.
Does that not just make object bouncy?

AlexeyKnyshev

12-07-2013 17:48:29

I am not sure I understand.

Once I think I managed to convert like a dog mesh or something to a trimesh exactly the same shape as the dog shape and the collision would work as ecpected when being thrown around, instead of having a box or sphere collision shape.
But I am not sure I actually had it working or if this is easily possible or not.

Now I have the trished object but it can not be dynamic only at a static position, that is it does not rotate when falling and hitting other objects.

I am not sure the softbody is what I need.
Does that not just make object bouncy?


Bouncy of soft body is an option. I'll try to investigate your quest. As the result I'm going to report here.

Best regards, Alexey Knyshev

OGREHEAD

15-07-2013 13:57:55

This is the part I am trying to get to work.
A trimesh dropping down on a box.


BoxCollisionShape *Shape1 = new BoxCollisionShape( SceneNode1Size );
RigidBody *Body1 = new RigidBody ( SceneNode1->getName(), World1 );
Body1->setShape( SceneNode1, Shape1, 0.6f, 0.6f, 10000.0f, SceneNode1Position, SceneNode1Orientation );
Body1->enableActiveState();

Entity *Entity2 = SceneManager1->getEntity( "DogMesh" );
StaticMeshToShapeConverter *trimeshConverter = new StaticMeshToShapeConverter( Entity2 );
TriangleMeshCollisionShape *sceneTriMeshShape = trimeshConverter->createTrimesh();
delete trimeshConverter;
RigidBody *Rigid2 = new RigidBody( "Rigid2", World1 );
Rigid2->setShape(SceneManager1->getSceneNode( "DogMesh" ), sceneTriMeshShape, 0.0f, 0.0f, 0.8f, SceneNode2Position, SceneNode2Orientation);
sceneRigid->enableActiveState();


But as explained previously, the DogMesh does not rotate when hitting the box shape.

AlexeyKnyshev

15-07-2013 23:13:48

The main problem is that you use StaticMesh converter. This means that it cannot be used as dynamic object (or with limitations)

dermont

16-07-2013 08:07:49

OGREHEAD:

You should take a look at the bullet forums/apis, TriangleMeshCollisionShape creates a btBvhTriangleMeshShape (a static-triangle mesh shape).
http://bulletphysics.org/Bullet/phpBB3/ ... 30&start=0

You could try fudging it using a compound collision shape.


OgreBulletCollisions::CompoundCollisionShape* compound=new OgreBulletCollisions::CompoundCollisionShape();

...
compound->addChildShape(sceneTriMeshShape,Ogre::Vector3(0,0,0));
Rigid2->setShape(node2, compound, 0.0f, 0.0f, 0.8f, Ogre::Vector3(40.0,100.0,0.0), node2->_getDerivedOrientation());


Why don't you use a convex shape (or a GImpactConcaveShape ) instead of a btBvhTriangleMeshShape?

OgreBulletCollisions::ConvexHullCollisionShape *sceneTriMeshShape = trimeshConverter->createConvex();
//OgreBulletCollisions::GImpactConcaveShape *sceneTriMeshShape = trimeshConverter->createConcave();

OGREHEAD

16-07-2013 16:03:21

Hey

I was not aware that I used static, but I can see that I do.
I do this of not particualr reason.
Just found some code and thought it would work. I did not notice the static part.

I will try to change what you suggested.

So are you saying that it can be done, if I just change that?

Also can I just use everything from bullet api when ogrebullet is implemented?

OGREHEAD

16-08-2013 17:12:33

I still have not found a solution to this.

Does anyone know if this can be done and if so how more precisely?

cyril06

17-05-2017 14:58:18

Hi,
I'm having exactly the same issue i have a project to finish and i can't find any solutions... can someone help me ?