@edapx wrote:
I'm trying to use this method https://glm.g-truc.net/0.9.0/api/a00162.html in order to find the intersection between a ray (with origin
X
and directionwi
) and a mesh. The problem that I'm having now is to convert the position of the vertices of the 3d primitive, in this case a box, to global space.This is my code
ofColor RayCaster::L_i(const glm::vec3& X, const glm::vec3& wi) const { // for all the triangles in a mesh // Find the first intersection (and the closest!) with the scene glm::mat4 globalTransfMatrix = this->box.getGlobalTransformMatrix(); vector<ofMeshFace> faces = this->mesh.getUniqueFaces(); bool found = false; for(ofMeshFace face : faces){ glm::vec3 baricenter; found = glm::intersectRayTriangle(X, wi, face.getVertex(0) * globalTransfMatrix, face.getVertex(1) * globalTransfMatrix, face.getVertex(2) * globalTransfMatrix, baricenter); if (found) { break; } } // black and white debug if (found) { return ofColor(255,0,255); } else { return ofColor(0,0,0); } }
The error that I'm having is
"
Use of overloaded operator '*' is ambiguous (with operand types 'const glm::tvec3' and 'const glm::mat4' (aka 'const tmat4x4'))
"I've already tried to multiply a glm::vec4 for glm::mat4, but in this case I was having another error, saying that the signature of the method is not correct.
Any Ideas?
Posts: 2
Participants: 2