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

Assertion error #26

Closed
rweichler opened this Issue Sep 7, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@rweichler

rweichler commented Sep 7, 2016

I'm not sure if this is because I'm using the library wrong, or if this is a bug. I managed to reproduce it with this code:

#include "reactphysics3d.h"

using namespace rp3d;

int main(int argc, char *argv[])
{
    DynamicsWorld *world = new DynamicsWorld(Vector3(0, -9.81, 0));
    // floor
    {
        BoxShape *shape = new BoxShape(Vector3(10, 1, 10));
        RigidBody *body = world->createRigidBody(Transform(Vector3(0, 0, 0), Quaternion(0, 0, 0, 1)));
        body->setType(STATIC);
        body->addCollisionShape(shape, Transform(Vector3(0, 0, 0), Quaternion(0, 0, 0, 1)), 90);
    }
    // box
    {
        BoxShape *shape = new BoxShape(Vector3(2, 2, 2));
        RigidBody *body = world->createRigidBody(Transform(Vector3(0, 10, 0), Quaternion(0, 0, 0, 1)));
        body->setType(DYNAMIC);
        body->addCollisionShape(shape, Transform(Vector3(0, 10, 0), Quaternion(0, 0, 0, 1)), 90);
    }
    while(true) {
        world->update(1.0f/60.0f);
    }
    return 0;
}

And the error:

Assertion failed: (wDotv > 0.0), function computePenetrationDepthAndContactPoints, file deps/reactphysics3d/collision/narrowphase/EPA/EPAAlgorithm.cpp, line 391.
Abort trap: 6

You can't see it in the command line, but in my game It errors the instant the box collides with the floor.

I think it's because I add the 2x2x2 box's shape to the body at (0, 10, 0) instead of (0, 0, 0) as it probably wants. Because if I put (0, 0, 0) for the position in addCollisionShape, it works as expected.

Also, if you don't do that and instead set the 2x2x2 box's size to 1x1x1, it stops crashing and works as expected.

Edit:

Also, another bug: If you try to update the dynamics world when it has no bodies, it crashes, presumably because it wants always to have bodies in it.

Thanks.

@DanielChappuis DanielChappuis self-assigned this Sep 8, 2016

@DanielChappuis DanielChappuis added the bug label Sep 8, 2016

@DanielChappuis

This comment has been minimized.

Owner

DanielChappuis commented Sep 8, 2016

Thanks a lot for reporting this and thanks for your code. Can I ask you to try the same code but using the current "develop" branch (instead of master) ? I have improved the robustness of the collision detection recently. Also let me know if it still crashes with no bodies in the physics world.

Best Regards.

@DanielChappuis DanielChappuis added this to the Version 0.7.0 milestone Oct 27, 2016

@xendian

This comment has been minimized.

xendian commented Jan 15, 2017

I am getting the same assertion in EPAAlgorithm.cpp. Where can we get the fix?

@DanielChappuis

This comment has been minimized.

Owner

DanielChappuis commented Jan 20, 2017

I am currently working on improving the robustness of collision detection to fix this bug. I will let you know when this issue is fixed.

@DanielChappuis

This comment has been minimized.

Owner

DanielChappuis commented May 1, 2018

The version v0.7.0 of ReactPhysics3D has been released. This issue has been fixed in this release.
Thanks a lot for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment