Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConvexMeshShape issue (assert) #390

Open
DanielChappuis opened this issue Jun 27, 2024 · 1 comment
Open

ConvexMeshShape issue (assert) #390

DanielChappuis opened this issue Jun 27, 2024 · 1 comment

Comments

@DanielChappuis
Copy link
Owner

          I'm trying to use Irrlicht to generate the bounding box since Irrlicht makes rectangles that more closely resemble the mesh. Since this can't do rectanlges, I'm trying to make it work with ConvexMeshShape. I made it so that my program gets Irrlicht to return the bounding box and im trying to make it convert that to a ConvexMeshShape.

Changing the vertex count from 8 to 24 allowed it to work a lot better but some rectangles cause the game to crash when collided. There is this one model whos collision box always causes a crash when an object bumps into it but my other models don't. The error is: "reactphysics3d/collision/shapes/ConvexMeshShape.cpp:106: virtual reactphysics3d::Vector3 reactphysics3d::ConvexMeshShape::getLocalSupportPointWithoutMargin(const reactphysics3d::Vector3&) const: Assertion `maxDotProduct >= decimal(0.0)' failed."

I had to go into the source code for this one. In ConvexMeshShape.cpp in the getLocalSupportPointWithoutMargin() function, there is a line of code "assert(maxDotProduct >= decimal(0.0));". I commented that out. The game no longer crashes when object collide into that one object. I don't know what the implications of this hack are but if I'm doing this wrong and that's the reason it's crashing, I would love to find out what the correct way is.

If I can use this to avoid implementing my own special colliders by building off of the plane class, I will. I was just wondering if ConvexMesh is out of date or borked and we're not supposed to be using it or if this is user error.

Originally posted by @Xeraster in #385 (comment)

@DanielChappuis
Copy link
Owner Author

@Xeraster I am not really sure I understand what you are trying to do. Are you trying to create a rectangular box collision shape for your mesh? If so, you need to use the BoxShape collision shape of the library not the ConvexMeshShape. The ConvexMeshShape is only used in the documentation for a box convex mesh to demonstrate how to use it but if you need a box, you need to use the BoxShape.

Is it what you are trying to do? If not, could you please explain what you are trying to do exactly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant