get trimesh triangle

Zurzaza
Posts: 11
Joined: Tue Aug 24, 2010 9:34 pm

get trimesh triangle

Post by Zurzaza »

hi all,
i'm doing a ray cast test and i also need to know the triangle that has been hitten.
By looking in the LocalRayResult structure, i found that m_shapePart and m_triangleIndex (in the m_localShapeInfo pointer), contains some information about that.
So, i tried to write some code like this:

Code: Select all

btPrimitiveTriangle pt;
((const btGImpactMeshShapePart::TrimeshPrimitiveManager*)getMeshPart(m_shapePart)->getPrimitiveManager())->get_primitive_triangle(m_triangleIndex,pt);
but it always generates a null pointer exception.
By debugging the function, i noticed that the exception was thrown in the getVertex() function of the primitive manager, and i can't find a solution.

Is there anyway to obtain a trimesh triangle, by specifying the shape part and the triangle index?
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: get trimesh triangle

Post by mi076 »

Zurzaza
Posts: 11
Joined: Tue Aug 24, 2010 9:34 pm

Re: get trimesh triangle

Post by Zurzaza »

thank you very much, i solved the problem! ;)