Hi, I have question about converting mesh generated from heightmap to Bullet btTriangleMesh. My current mesh converter don't work with terrain meshes. I get mesh in follow steps:
1. I generate ITerrainSceneNode.
2. I copy terrain LOD Buffer to CDynamicMeshBuffer.
3. I convert MeshBuffer to btTriangleMesh.
This is differences between 'collision' and 'drawing' meshes:
Collision mesh look as mix between Convex Hull and BVH... I have similar results when I use btTriangleIndexVertexArray instead btTriangleMesh
[Bullet] Irrlicht Terrain Mesh to Bullet Mesh
[Bullet] Irrlicht Terrain Mesh to Bullet Mesh
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Have you looked at the bullet height field primitive? It is designed specifically for terrain.
Look at "btHeightfieldTerrainShape.h" in the bullet sdk under src\BulletCollision\CollisionShapes.
Look at "btHeightfieldTerrainShape.h" in the bullet sdk under src\BulletCollision\CollisionShapes.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
No, currently I don't test btHeightfieldTerrainShape, because two independent create meshes first via Irrlicht and second via Bullet can return differences results eg. more smoothly etc... so I think BVH is better solution for it. I think problem is in Irrlicht terrain mesh structure, so converter can't rewrite it properly.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Thanks for interesting of my problem, but I solved my problem.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
In currently Irrlicht version indices are storage in irr::u32, so in Your Irrlicht to Bullet mesh converter You also have to change irr::u16 to irr::u32 eg.
to
Now all will be ok
Code: Select all
irr::u16* mb_indices = mb->getIndices();
Code: Select all
irr::u32* mb_indices = (irr::u32*)mb->getIndices();
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
You should check the index type first with getIndexType()Nadro wrote:In currently Irrlicht version indices are storage in irr::u32, so in Your Irrlicht to Bullet mesh converter You also have to change irr::u16 to irr::u32 eg.toCode: Select all
irr::u16* mb_indices = mb->getIndices();
Now all will be okCode: Select all
irr::u32* mb_indices = (irr::u32*)mb->getIndices();