Create soft body from meshes with CreateFromTriMesh in Bullet

Soft body vs Rigid body collision in Bullet for iOS / iPhone App Development Memo
↑This cloth bellow is made as soft body, which is a plane. So I tried three dimensional shape next.
But I wonder how to make data for Bullet.
I found one method :
This may make data for Bullet from one which has vertex information or something made from Blender.

The result is here :

bullet soft body 1

Well, this method seems to work as I expected. The data for Bullet is actually created from triangle meshes.
But the meshes looks too large. They should be smaller. You can see a triangle in the image above.

So I made one cube with more meshes in Blender.

cube in Blender

This cube has 900 vertices. One face have 5x5=25 squares. OpenGL for iOS can treat only triangle, so one face has 25x2=50 triangles. Therefore 50x3=150 vertices in one face, and 150x6 = 900 vertices in the cube. Each vertex needs three float (x,y,z).
When I started the app, it terminated abnormally. But it must not be ‘stack over flow’, I suppose.
So I reduced vertices to calculate and show, to about one third.

bullet soft body 2

This body actually looked like soft body, but this is not enough.
My setting may be wrong but I gave up… orz
I suppose I had better use rigid body and spring (than soft body).
Develop | Comments(0) | Trackback(0)