Closed lp64ace closed 4 years ago
Hello. Thanks a lot for reporting this and sorry for my late answer.
Can I ask you to compile the ReactPhysics3D in DEBUG mode and tell me exactly at which line the exception is thrown inside the PolyhedronMesh() call ? The exception is probably not thrown at the line you mentioned but from inside the code of the library itself.
That would help me a lot. Best regards.
I am so sorry about my late answer as well . A couple of months ago I quit this project after moving from vs 2017 to vs 2019 due to some libraries incompatabilities , I am currently working on version 2.0 of the project and I have build reactphysics3d for RlsWithDbgInfo but I have no idea where I can read those messages from so I can give you some feedback base on this problem.
P.S. please update the user manual.
You should build the Reactphysics3D library with the Debug flag instead of RlsWithDebgInfo so that when the exception is thrown your debugger will stop at the exact line where the issue is located.
Have you been able to find the exact line where the exception is thrown ?
Hello, I believe I am getting this error as well!
I have a model created with Blender, imported into my C++ project with assimp (which explicitly says it winds the faces CCW, so I don't think that's the issue). The assimp-loaded data is then fed into a rp3d::PolygonVertexArray
much like in OP's code snippet above.
Here's what valgrind reports:
terminate called after throwing an instance of 'std::runtime_error'
what(): No item with given key has been found in the map
==10021==
==10021== Process terminating with default action of signal 6 (SIGABRT)
==10021== at 0x6AE7E97: raise (raise.c:51)
==10021== by 0x6AE9800: abort (abort.c:79)
==10021== by 0x61F6956: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10021== by 0x61FCAB5: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10021== by 0x61FCAF0: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10021== by 0x61FCD23: __cxa_throw (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==10021== by 0x241B73: reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) (Map.h:652)
==10021== by 0x23FA2E: reactphysics3d::HalfEdgeStructure::init() (HalfEdgeStructure.cpp:121)
==10021== by 0x23EB9C: reactphysics3d::PolyhedronMesh::createHalfEdgeStructure() (PolyhedronMesh.cpp:93)
==10021== by 0x23E90D: reactphysics3d::PolyhedronMesh::PolyhedronMesh(reactphysics3d::PolygonVertexArray*) (PolyhedronMesh.cpp:48)
==10021== by 0x1AF801: Redacted::createCollisionMeshFromOBJFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (Redacted.cpp:121)
==10021== by 0x1AF092: Redacted::Redacted(Pterodacted, glm::vec<3, float, (glm::qualifier)0>, reactphysics3d::DynamicsWorld&) (Redacted.cpp:76)
This corresponds to line 116 of this file from the 0.7.1 release (I modified the file to figure out exactly which Map access caused it, hence the mismatching line numbers).
From the valgrind output I determine that the Map in No item with given key has been found in the map
is in reference to mapEdgeToIndex
.
I haven't gotten any further than this, so hopefully this is useful for you. Find attached the model I'm using (OBJ file, a single elongated and triangulated rectangular prism).
I was able to get the sample code from the User Manual working, so I suspect it's related to the specifically to file-loaded models.
Scratch that. Under further investigation I believe this is not being caused by rp3d, but by my own code (incorrect indices). It appears that Assimp produces duplicate vertices, which is causing identical edges to appear unique.
I was able to tell assimp to merge duplicate vertices by discarding *all* vertex data except position (normals, tangets, UVs, etc), which has solved the issue for me.
I was able to tell assimp to merge duplicate vertices by discarding all vertex data except position (normals, tangets, UVs, etc), which has solved the issue for me.
Ok perfect. That's good news.
I get an Exeption thrown here "rp3d::PolyhedronMesh *polyhedronMesh = new rp3d::PolyhedronMesh ( polygonVertexArray ) ;" without polygonVertexArray being NULL
` for ( auto mesh : model->meshes ) {
`