i have create a terrain triangles list shapes,and used hkpBvCompressedMeshShape to create it.in set info code
TerrainConstructionInfo cInfo( &geometry);
{
cInfo.m_convexRadius = 1.0f;
cInfo.m_weldingType = hkpWeldingUtility::WELDING_TYPE_NONE;
cInfo.m_collisionFilterInfoMode = hkpBvCompressedMeshShape::PER_PRIMITIVE_DATA_PALETTE;
cInfo.m_userDataMode = hkpBvCompressedMeshShape::PER_PRIMITIVE_DATA_PALETTE;
}
// Construct the mesh shape using our construction info
//m_meshShape = hkRefNew<hkpBvCompressedMeshShape>(createBvCompressedMeshShape());
hkpBvCompressedMeshShape* pShape = new hkpBvCompressedMeshShape( cInfo );
//hkpSimpleMeshShape* pShape = new hkpSimpleMeshShape()
// Create body with the mesh shape
{
hkpRigidBodyCinfo info;
info.m_shape = pShape;
info.m_motionType = hkpMotion::MOTION_FIXED;
info.m_friction = 0.5f;
info.m_position.set(0.0f,0.0f,0.0f);
hkpRigidBody* pMeshBody = new hkpRigidBody(info);
m_pWorld->addEntity(pMeshBody);
pMeshBody->removeReference();
}
in raycast ,the keycode
mys3_bool hit = false;
if(rayOutput->hasHit())
{
hit = true;
const hkpShape* pShape = command->m_results->m_rootCollidable->getShape();
if (pShape->getType() == hkcdShapeType::BV_COMPRESSED_MESH)
{
// Retrive child shape.
hkpShapeBuffer shapeBuffer;
const hkpShape* childShape = reinterpret_cast<hkpBvCompressedMeshShape*>(it->second.pShape)->getChildShape(rayOutput->m_shapeKeys[0], shapeBuffer);
//triangle_index = childShape->getUserData();
hkArray<hkUint32> & userData = reinterpret_cast<hkpBvCompressedMeshShape*>(it->second.pShape)->accessUserDataPalette();
triangle_index = reinterpret_cast<hkpBvCompressedMeshShape*>(it->second.pShape)->getPrimitiveUserData(rayOutput->m_shapeKeys[0]);//return max value is 255
}
but i want to return the real triangle index,how can i do?



